-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Not able to parametarize the limit in stored procedure #1623
Comments
I don't see any I'm guessing, you are looking for this: ( from the
// get the client
const mysql = require('mysql2');
// create the connection
const con = mysql.createConnection(
{host:'localhost', user: 'root', database: 'test'}
);
con.promise().query("SELECT 1")
.then( ([rows,fields]) => {
console.log(rows);
})
.catch(console.log)
.then( () => con.end()); |
@Himadri93 not sure if related, but have a look at #1239 TLDR: currently execute sends js numbers as DOUBLE mysql type in a PS call parameter, and mysql server > 8.0.22 does not like this combination ( LONG int in expected parameter type and DOUBLE in actual type ). One way to work around this issue right now is to convert your number parameter to a string, in that case its sent as VAR_STRING and for some reason string -> long conversion is allowed ) |
My guess is that meant to be "prepared statement" but please correct me if I'm wrong @Himadri93 and you are actually using stored procedures |
Keeps happening as of version '8.0.27'. |
Can you confirm if converting parameter to a string fixes a problem for you @JuanGdelaCruz ? |
Yes it does! |
I wonder if it worth adding as temporary fix a link to error explanation and ways to fix until we have 100% reliable automatic solution |
Only when error is "Incorrect arguments to mysqld_stmt_execute" |
closing as exact duplicate of #1239 |
const command =
SELECT * FROM TableName ORDER BY id LIMIT ?;
;await connect.promise().execute(command, [itemsPerPage]);
Hello, i am parameterize the limit VALUE and requesting the query using execute command, its throwing me error status 500,
how can i achieve the same?
The text was updated successfully, but these errors were encountered: