Skip to content
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

insert_ignore and dupe #59

Open
aseprano opened this issue Nov 15, 2019 · 1 comment
Open

insert_ignore and dupe #59

aseprano opened this issue Nov 15, 2019 · 1 comment
Assignees
Labels

Comments

@aseprano
Copy link

Using the query builder following the documentation leads to an error: the argument list is not used as in the example (https://www.npmjs.com/package/node-querybuilder#insert_ignoretable-dataon_dupe-callback):

.insert_ignore(table, data[,on_dupe][, callback])

Looks like the third parameter is always expected to be the callback, not the on_dupe as above. Using the above signature will lead the query builder to totally ignore the on_dupe parameter.

That is: using the following code:
conn.insert_ignore('mytable', {a: 10, b: 100}, 'ON DUPLICATE KEY UPDATE ...', (err, res) => {})

is wong and won't build the right query.

The following works fine:

conn.insert_ignore('mytable', {a: 10, b: 100}, (err, res) => {}, 'ON DUPLICATE KEY UPDATE ...')

@kylefarris kylefarris self-assigned this Nov 18, 2019
@kylefarris kylefarris added the bug label Nov 18, 2019
@kylefarris
Copy link
Owner

Thanks for the bug report @aseprano. I'll look into it today if I get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants