-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
client.query(sqlString, params[], function) alters the given params[] #750
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
yeah that totally sucks! Sorry about that. Do you wanna submit a PR for that change w/ a little test? If not, I can bang one together. |
Hi Brian, maybe it's faster if you do the change directly, I've never done a Pull request... but I promise I will start learning and contribute :) |
@ngervasi |
You're right Vitaly, it's time to actively contribute to the project, I sent my pull requests but I didn't create the tests, I'm unsure about how to do that properly. Can someone give me a hint about it? I'm not familiar with node tests... btw: thanks Brian for this impressive project! |
All tests are in \test sub-folder. Typically, you either amend an existing test or add a new one. Given the nature of the issue, I'd say you have to create a new test. The syntax is very easy, and for details just look at the test library ;) |
Unfortunately not, I'm very busy and I wasn't able to learn how to setup the test, if you have time have a look at my patch and feel free to submit it on your own. Sorry bout that but it's a tough time. |
When supplying a parameters array to client.query the given array is modified (in my case it originally was an array of numbers and got transformed to an array of strings). This is not correct behaviour, I see the problem in the source code (query.js, line 143):
If transformation is needed it should be done on a clone of the passed array so that it doesn't break any logic in case the original array is reused somewhere else after the query.
I think a quick fix would be to change (query.js, line 14) from:
to
The text was updated successfully, but these errors were encountered: