[CONJ-152] Bug using "rewriteBatchedStatements=true" and PreparedStatement Created: 2015-05-13  Updated: 2015-06-23  Resolved: 2015-06-23

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.1.8
Fix Version/s: 1.1.9

Type: Bug Priority: Minor
Reporter: S. Walls Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Environment:

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.


Generated at Thu Feb 08 03:13:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.