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

Bug using "rewriteBatchedStatements=true" and PreparedStatement

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 1.1.8
    • 1.1.9
    • Other
    • None
    • Windows 7 64bit, connecting to a MySQL 5.5.25 server

    Description

      When "rewriteBatchedStatements=true" is used and executeBatch() is called twice with no addBatch() calls between them, there is a bug in the rewrittenBatch() method in class MySQLPreparedStatement.

      At the end of the first call to executeBatch(), the clearBatch() method is called which sets
      "firstRewrite = null; isRewriteable = true;"

      On the second call to executeBatch(), the conditional statement in rewrittenBatch() only checks if "isRewriteable" is true, which is true from the call to clearBatch(). However, if no addBatch calls were made, firstRewrite is null, and the line "result.append(firstRewrite);", results in "result" being set to the string "null". The last character is eventually removed, so the method rewrittenBatch() returns the string "nul". An exception is eventually thrown when the query "nul" is executed.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            swalls S. Walls
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.