krummas / DrizzleJDBC

A BSD licensed JDBC driver for Drizzle and MySQL
BSD 3-Clause "New" or "Revised" License
31 stars 22 forks source link

Prepared statements fail to execute if a back-quoted column name contains a '?' #45

Open StephG38 opened 6 years ago

StephG38 commented 6 years ago

With a table defined as : CREATE TABLE question ( a? int(11) NOT NULL AUTO_INCREMENT, b? char(80) DEFAULT NULL, PRIMARY KEY (a?));

Inserting data with a prepared statement ( INSERT INTO question ( a? , b? ) VALUES ( ? , ?) ) would fail with :

org.drizzle.jdbc.internal.common.QueryException: You need to set exactly 4 parameters on the prepared statement at org.drizzle.jdbc.internal.common.query.DrizzleParameterizedQuery.length(DrizzleParameterizedQuery.java:88) at org.drizzle.jdbc.internal.common.packet.commands.StreamedQueryPacket.send(StreamedQueryPacket.java:67) at org.drizzle.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:439) at org.drizzle.jdbc.DrizzlePreparedStatement.executeUpdate(DrizzlePreparedStatement.java:126)

This is due to the fact that the parameterized query does not handle '`', but only single and double quote