Coder Social home page Coder Social logo

Comments (13)

sidorares avatar sidorares commented on August 25, 2024

Can you post full query text where error can be reproduced?

from node-mysql2.

sidorares avatar sidorares commented on August 25, 2024

also, what happens when you prepare & execute your query from the command line client? See examples how to use PREPARE here - http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html

from node-mysql2.

brooly avatar brooly commented on August 25, 2024

You can find attached my query, and what happens with it executing from the command line client. It works.
mysql2

from node-mysql2.

sidorares avatar sidorares commented on August 25, 2024

create a gist please so I can copy&pasete text

from node-mysql2.

brooly avatar brooly commented on August 25, 2024

I know that the problem is with NOT IN clause, because I've subdivied the query until get where is the error, and if I execute the simplified query:
SELECT D.ID_DATO FROM DATOS D WHERE ID_DATO NOT IN(?,?)
It fails, but the same query in positive works perfectly
SELECT D.ID_DATO FROM DATOS D WHERE ID_DATO IN(?,?)
Both of them works from the command line.

from node-mysql2.

brooly avatar brooly commented on August 25, 2024

https://gist.github.com/brooly/6544575

from node-mysql2.

sidorares avatar sidorares commented on August 25, 2024

Thanks! On it :)

from node-mysql2.

sidorares avatar sidorares commented on August 25, 2024

Can't reproduce on a simple example. The ER_WRONG_ARGUMENTS indicates that number of arguments you are passing to prepared statement is different from what it actually expect. My example - https://gist.github.com/sidorares/6545549

from node-mysql2.

brooly avatar brooly commented on August 25, 2024

You're right, your example works for me too, I don't know what's happening with my query because the number of arguments is right (If I remove the "NOT" it works). Anyway it's clear that is my fault, sorry for the inconvenience.

Thanks crack!

from node-mysql2.

sidorares avatar sidorares commented on August 25, 2024

if you set breakpoint (or dump with console.log) here - https://github.com/sidorares/node-mysql2/blob/master/lib/commands/execute.js#L48 - you'll be able to see expected number of parameters.

from node-mysql2.

sidorares avatar sidorares commented on August 25, 2024

or, even better - here - https://github.com/sidorares/node-mysql2/blob/master/lib/commands/execute.js#L60
See parameterDefinitions array with parameter types etc

from node-mysql2.

sidorares avatar sidorares commented on August 25, 2024

I'll probably add some way to access parameterDefinitions from response and error, same way you can access field definitions

from node-mysql2.

brooly avatar brooly commented on August 25, 2024

I'll try, once I solve it I will tell you 👍

from node-mysql2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.