Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-283

MariaDbClientPreparedStatement - syntax error on insert values

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.0, 1.3.7, 1.4.1, 1.4.2
    • Fix Version/s: 1.4.3
    • Component/s: Other
    • Labels:
      None
    • Environment:
      Windows\linux connecting to MySQL 5.5.X

      Description

      When either by configuration of "useServerPrepStmts=false"
      Or when MariaDbServerPreparedStatement.prepare has failed (the reason here does not matter , probably because of high load)
      and the MariaDbConnection fallback is MariaDbClientPreparedStatement.

      a query such as "INSERT INTO mytable VALUES (?,?) , (?,?)"
      is broken down to the following query parts (using function createRewritableParts):
      [0] INSERT INTO mytable VALUES
      [1] (
      [2] ,
      [3] )
      [4] ,(
      [5] ,
      [6] )

      this results in the final query to be sent as:
      INSERT INTO mytable VALUES ( param[0],param[1])param[3],(param[4],)

      results in syntax error.

      i have checked the older code of version 1.1.8 (before 1.3.0, and 1.1.8 is the version i used before)

      in that version in class MySQLParameterizedQuery the createQueryParts
      breaks down the query like this:

      [0] INSERT INTO mytable VALUES (
      [1] ,
      [2] ),(
      [3] ,
      [4] )

      and then the query is sent correctly to the DB

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              diego dupin Diego Dupin
              Reporter:
              orgerson or gerson
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: