connection.query("call vts_active_tagid('"+RFIDNumber+"','"+Latitude+"','"+Longitude+"','"+datetime+"','"+imeno+"',@passengers,@trip)");
this stored procedure gives one output which contains firstname,phone number and passengerid,how to get those values in the nodejs code
First thing first, set your mysql to accept multiple statement
set mysql.createConnection({multipleStatements: true});
Do your query
query_str = "CALL sp_whatever(?,?,?,@output); select @output";
con.query(query_str, [param1, param2, param3], function(err,rows){
if(err) throw err;
console.log(rows);
});
Output:
[OkPacket {
fieldCount: 0,
affectedRows: 0,
insertId: 0,
serverStatus: 10,
warningCount: 0,
message: '',
protocol41: true,
changedRows: 0 },
[ RowDataPacket { '@output': -2 } ] ]
a sample for you
dbConnection.getConnection(function(err, connection){
var edituserSQL = "CALL spEditTheme(?,?,?,?)";
var resultt;
connection.query(edituserSQL, [ object.selfid,object.theme_background,object.theme_foreground,dateTimeNow ], function(ERROR,RESULT) {
if (ERROR) {
cb(ERROR, null);
} else {
console.log("exEditUserTheme result");
console.log(RESULT);
var account = RESULT[0][0].result;
cb(null, account);
}
});
connection.release();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With