Skip to content

Broken pool.query for 2-arity #872

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

Closed
ghost opened this issue Jul 17, 2014 · 7 comments
Closed

Broken pool.query for 2-arity #872

ghost opened this issue Jul 17, 2014 · 7 comments
Labels

Comments

@ghost
Copy link

ghost commented Jul 17, 2014

Hi! I noticed that the following lines of code have been removed from the pool.query function between v2.3.2 and v2.4.0:

  if (typeof values === 'function') {
    cb = values;
    values = null;
  }

  if (!cb) {
    // Ignore results and errors if no cb supplied; matches connection.query
    cb = function () {};
  }

As a result, in v2.4.0, when I attempt to call pool.query with only two parameters --- a sql query and a callback function, my code breaks.

Was this an intentional change, in which case, I need to use explicit null values when calling the function, or is this something that you can fix? Thanks.

@dougwilson
Copy link
Member

The following test functions and calls pool.query with only two values, a sql query and a callback function: https://github.com/felixge/node-mysql/blob/master/test/unit/pool/test-query.js#L9

Can you post the specific code you are using that does not work?

@dougwilson
Copy link
Member

It looks like there is a mistake here: https://github.com/felixge/node-mysql/blob/master/lib/Pool.js#L172 where if there is an error getting the connection from the pool it will not work. Is this what is happening to you?

@dougwilson
Copy link
Member

OK, I'll assume that's a yes...

@dougwilson
Copy link
Member

Please run a npm install felixge/node-mysql and verify if your issue has been fixed.

@ghost
Copy link
Author

ghost commented Jul 17, 2014

Yes it has! Thanks for your help.

@dougwilson
Copy link
Member

Thanks for verifying :) This fix will be published as 2.4.1 in just a little bit once Travis CI actually tests the change.

@dougwilson
Copy link
Member

OK, published as 2.4.1 now.

@mysqljs mysqljs locked and limited conversation to collaborators Jul 17, 2014
seangarner pushed a commit to seangarner/node-mysql that referenced this issue May 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

1 participant