Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
1.5.0-RC
-
None
Description
When using rewriteBatchedStatements=true a java.sql.PreparedStatement containing parentheses around the '?' placeholders will fail. It will throw org.mariadb.jdbc.internal.util.dao.QueryException: You have an error in your SQL syntax; check the manual...
Demonstration is included below.
This was tested using mariadb-java-client-1.5.0-RC1.jar
 |
public class RewriteBatchedStatementsTest2 { |
public static void main(String[] args) throws SQLException { |
String url = "jdbc:mariadb://localhost:3306/information_schema?rewriteBatchedStatements=true"; |
Connection conn = DriverManager.getConnection(url, "root", ""); |
try { |
String failingQuery1 = "SELECT (1=? AND 2=2)"; |
String failingQuery2 = "SELECT (1=?) AND 2=2"; |
String workingQuery = "SELECT 1=? AND (2=2)"; |
PreparedStatement statement = conn.prepareStatement(failingQuery1);
|
try { |
statement.setInt(1, 1); |
statement.executeQuery();
|
} finally { |
statement.close();
|
}
|
} finally { |
conn.close();
|
}
|
}
|
}
|
|