You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having some issues with multiple statements. I am trying to insert a row then select from the same database but I am being told that there is an error in my second statement but there is not. They work when entered in via phpmyadmin interface but fail when used in node. I have tried dumming the multiple select down to its most basic level (the example given in the readme in fact) but am still seeing the same error.
var mysql = require('mysql');
var connection = mysql.createConnection(properties);
=> { '0':
{ [Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 2' at line 1]
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlState: '42000',
index: 0 },
'1': undefined,
'2': undefined }
Any pointers/reasons for this?
Thanks
Joe
The text was updated successfully, but these errors were encountered:
Hello! In order to use multiple statements in a single query (each statement is separated with a ;) you need to set multipleStatements to true in your configuration.
Example from what you pasted:
varmysql=require('mysql');properties.multipleStatements=true;// <-- this needs to be setvarconnection=mysql.createConnection(properties);connection.query('SELECT 1; SELECT 2;',function(){console.log(arguments);});
I am having some issues with multiple statements. I am trying to insert a row then select from the same database but I am being told that there is an error in my second statement but there is not. They work when entered in via phpmyadmin interface but fail when used in node. I have tried dumming the multiple select down to its most basic level (the example given in the readme in fact) but am still seeing the same error.
var mysql = require('mysql');
var connection = mysql.createConnection(properties);
connection.query('SELECT 1; SELECT 2;', function(){
console.log(arguments);
});
=> { '0':
{ [Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 2' at line 1]
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlState: '42000',
index: 0 },
'1': undefined,
'2': undefined }
Any pointers/reasons for this?
Thanks
Joe
The text was updated successfully, but these errors were encountered: