Declined
Details
Assignee
Sean CorfieldSean CorfieldReporter
importimportPriority
Major
Details
Details
Assignee
Sean Corfield
Sean CorfieldReporter
import
importPriority

Created October 20, 2016 at 5:39 AM
Updated November 13, 2016 at 12:38 AM
Resolved November 13, 2016 at 12:38 AM
A parameters map of insert! cannot contain keys of reserved words. For example, because "contain" is a reserved word of MySQL, the following code will cause MySQLSyntaxErrorException.
(jdbc/insert! db-spec :foo {:condition "a"}) => 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 'condition ) VALUES ( 'a' )' at line 1 sun.reflect.NativeConstructorAccessorImpl.newInstance0 (NativeConstructorAccessorImpl.java:-2)
A workaround is using quoted string as a key of the map.
(jdbc/insert! db-spec :foo {"`condition`" "a"}) => ({:generated_key 1})
However, I think that all keys of the params map should be quoted by default.