-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Raw SQL query reports syntax error when there seems to be no error #4192
Comments
Hi @anthozep! It looks like you missed a step or two when you created your issue. Please edit your comment (use the pencil icon at the top-right corner of the comment box) and fix the following:
As soon as those items are rectified, post a new comment (e.g. “Ok, fixed!”) below and we'll take a look. Thanks! *If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact inquiries@sailsjs.com |
Fixed the verification steps! |
@anthozep Thanks for posting, we'll take a look as soon as possible. For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here. |
@anthozep The issue here is that by default, the Node MySQL driver doesn't allow running multiple queries at once. This is to guard against SQL injection. You have a couple of options here. If you don't need connection pooling for your app, you can turn it off and then run each of those statements individually. Because all the statements would use the same connection, it should allow the transaction to work, and potentially the As an alternative, you could try setting Sails 1.0 is stricter as far as what config properties are allowed, and I don't think Closing this as it's not a bug in the Sails core, but feel free to post back here if either of those suggestions works out or if you find another solution! |
@sgress454 , this concept was super hard to find. Is there a reason why this is not present in the documentation? |
Sails version: "^0.12.9"
Node version: "4.x"
NPM version: "4.x"
DB adapter name: sails-mysql
DB adapter version: "^0.11.5"
Operating system: Windows
I posted this on SO here: https://stackoverflow.com/questions/46229400/sails-js-waterline-raw-sql-query-reports-syntax-error-when-there-seems-to-be-no
I have the following query so I can copy some rows into the same table:
This works perfectly in MySQL workbench. I then ran the query through Sails.js (using the sails-mysql adapter) but I get the error:
I've logged the query to the console and it looks fine.
Here's the sails code:
The result is essentially a copy of the temporary table reinserted into the original table, with the field property changed.
I've also tried specifying \n as the delimiter, to no avail
The text was updated successfully, but these errors were encountered: