-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL and quoting #20
Comments
(korma.core/set-delimiters "`") should do the trick :) 0.3.0-alpha2 has the change. |
Thanks for such short reaction time. |
I think this is an issue again with 0.3.0-alpha5. The delimiter atom is changed but doesn't seem to be picked up in the actual delimit-str call (using korma.config/set-delimiters). |
Are you setting it before you define you do (defdb)? If so, just move it after and it should work (I'll make that smarter). A much better, and brand new, solution is to do it as part of your defdb: (defdb prod (mysql {:db "blah" :user "blah" :password "hey" :delimiters "`"})) |
That did it, ty :) |
There is an issue with MySQL which is more on MySQL side but still. The thing is that MySQL doesn't by default use double quotes to quote field names. It uses backtiks. And double quotes are reserved for string literals. So, basically out of the box Korma doesn't work with MySQL. There is a workaround which is to run (exec-raw "set sql_mode='ANSI_QUOTES'") before executing any queries. But I'm not sure if this will work with multiple connections from pool, unless one would run the aforementioned query before executing any other query. Also it may be possible to change this in MySQL config but that is not always an option. So, what I would like to see is an ability to set quoting character in Korma itself. And maybe even predefined quoting characters for different database types.
The text was updated successfully, but these errors were encountered: