When I make a call to insert with multiple rows in korma I get the exception
Question
When I make a call to insert with multiple rows in korma I get the exception...
Failure to execute query with SQL:
...snip...
SQLException:
Message: near ",": syntax error
SQLState: null
Error Code: 0
What is going on?
Extra details: I am using sqlite as my database.
Solution
Korma doesn't attempt to cover every little kink in every database. In this case sqlite3 doesn't support the syntax that is generated by korma.
See this question for the root of the problem: Is it possible to insert multiple rows at a time in an SQLite database?.
See this discussion on Korma's discussion group for Korma's stance on the issue: https://groups.google.com/forum/?fromgroups#!msg/sqlkorma/t7lwpD5np9w/Vf-T52fQrSwJ
OTHER TIPS
It's worth noting that since SQLite release 3.7.11, INSERT
statements can contain multiple rows in the VALUES
clause. Brian Campbell first pointed this out in this answer, which links to the SQLite release log for 3.7.11. So by now, whatever operating system you're using will likely have an SQLite version greater than 3.7.11, which means that if you try to do this now, you may well succeed.