Field names for INSERT are unquoted
-----------------------------------
Key: CAY-878
URL: https://issues.apache.org/cayenne/browse/CAY-878
Project: Cayenne
Issue Type: Bug
Affects Versions: 3.0
Environment: MySQL/Tomcat/Cayenne
Reporter: Scott Anderson
Assignee: Andrus Adamchik
My INSERT query fails against MySQL because I have a field named `group` that
is not unquoted.
Oct 10, 2007 4:12:31 PM org.apache.cayenne.access.QueryLogger logQuery
INFO: INSERT INTO requests2 (autoengineer, close_time, completion_comments,
completion_passfail, completion_time, group, idx, lab_action, lab_budget,
lab_date_needed, lab_device_id, lab_location, lab_program, lab_rack_no,
lab_requesting_group, lab_serial_no, model_affecting, model_changes, platform,
priority, req_type, request, rpt_affecting, rpt_changes, state,
submission_comments, submit_time, submitter, testcnt, ui_affecting, ui_changes,
version) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Oct 10, 2007 4:12:31 PM org.apache.cayenne.access.QueryLogger logQueryParameters
INFO: [bind: NULL, '2005-11-02 10:51:13.0', '<br>IMPLEMENT COMMENTS: All
do...', NULL, '2005-11-02 10:34:39.0', NULL, 2, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, 'false', NULL, 'ClearQuest Tools', 03, NULL, 'Test Plan
Import Problems', 'false', NULL, 'CLOSED', 'Please update the CQ export to...',
'2005-10-12 13:18:42.0', 'ddarrah', 0, 'false', NULL, NULL]
Oct 10, 2007 4:12:32 PM org.apache.cayenne.access.QueryLogger logQueryError
INFO: *** error.
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server version for
the right syntax to use near 'group, idx, lab_action, lab_budget,
lab_date_needed, lab_device_id, lab_location' at line 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3249)
at
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1268)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1541)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1455)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1440)
at
org.apache.cayenne.access.jdbc.BatchAction.runAsIndividualQueries(BatchAction.java:191)
at
org.apache.cayenne.access.jdbc.BatchAction.performAction(BatchAction.java:84)
at
org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:57)
at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:236)
at
org.apache.cayenne.access.DataDomainFlushAction.runQueries(DataDomainFlushAction.java:225)
at
org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:143)
at org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:803)
at org.apache.cayenne.access.DataDomain$2.transform(DataDomain.java:770)
at
org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:829)
at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:767)
at
org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1159)
at
org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1072)
at com.airvana.nmms.autodb.test.main(test.java:91)
Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
[v.3.0-SNAPSHOT Sep 01 2007 17:06:09] Commit Exception
at
org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1191)
at
org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1072)
at com.airvana.nmms.autodb.test.main(test.java:91)
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an
error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'group, idx, lab_action,
lab_budget, lab_date_needed, lab_device_id, lab_location' at line 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3249)
at
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1268)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1541)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1455)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1440)
at
org.apache.cayenne.access.jdbc.BatchAction.runAsIndividualQueries(BatchAction.java:191)
at
org.apache.cayenne.access.jdbc.BatchAction.performAction(BatchAction.java:84)
at
org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:57)
at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:236)
at
org.apache.cayenne.access.DataDomainFlushAction.runQueries(DataDomainFlushAction.java:225)
at
org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:143)
at org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:803)
at org.apache.cayenne.access.DataDomain$2.transform(DataDomain.java:770)
at
org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:829)
at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:767)
at
org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1159)
... 2 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.