-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Sporadically, only the last query returns a result when using multiple queries? #389
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
Comments
Are you sure it's not a generic pool problem? I can execute that kind of queries with no problems. |
I have done quite a bit more testing. The problem is not what I thought it was originally, but I still believe it to be in node-mysql. The problem only occurs when the following 2 conditions are met:
For example, if I have have an sql query like so... var sql = "SELECT * FROM stuff WHERE ID = ?" db.query( sql, value, function() {...} ); ...and then I call it under race conditions, before too long it returns an empty array, which is incorrect. If I change my escape method to the following... value = value.toInt(); var sql = "SELECT * FROM stuff WHERE ID = " + value db.query( sql, function() { ... }); ...it works perfectly. I am now working around this problem in my code by manually escaping the values. However I would really prefer to use the parameterized query syntax. I hope this is helpful, please let me know if you have other questions |
A lot has changed since this time, but it sounds like your issue is hat whatever you are passing as |
…efactors auth response handling code into func to reduce some duplication of logic. Test requires a MySQL socket and user having privs to use it.
…h-fail-broken-pipe-error Fixes mysqljs#389 by not sending COM_QUIT until authenticated. Also refactor…
I am using Node-Mysql in combination with Generic-Pool to manage connection pooling.
I am using multiple queries.
I am running into a strange problem where once in awhile, without any pattern I can identify, only the last query is returning a result.
My code looks like this...
...As you can see result[0] should have 14 rows of data in it - and most of the time it does. But once in awhile, it comes back as an empty array.
I am hoping someone here may be able to advise.
Thanks (in advance) for your help.
The text was updated successfully, but these errors were encountered: