Unable to get Result Set from Stored Procedure call
Issue #26
resolved
I've updated to version 1.0.9, and SQL Statements are executing correctly (although I'm not binding parms), but when calling a stored procedure the result set is empty, even though the stored procedure is returning a row. I've also noticed that stmt.execute() is returning the in/out params as an array in the first parm, which seems to have been a recent change. Maybe I'm using the connector incorrectly...
let stmt: any = new connection.db.dbstmt(connection.conn);
stmt.prepare(sql, function(dbError) {
if(dbError !== undefined) {
stmt.close();
pool.release(connection);
return respondSqlError(res, sql, 'Prepare Error: ' + dbError);
}
...
stmt.bindParam([
[getAction, connection.db.SQL_PARAM_INPUT_OUTPUT, 1],
[numRows, connection.db.SQL_PARAM_INPUT, 2],
[lastName, connection.db.SQL_PARAM_INPUT, 1]
], function(dbError) {
if(dbError !== undefined){
stmt.close();
pool.release(connection);
return respondSqlError(res, sql, 'Bind Error: ' + dbError);
}
stmt.execute(function(inOutParms, dbError) {
if(dbError !== undefined){
stmt.close();
pool.release(connection);
return respondSqlError(res, sql, 'Execute Error: ' + dbError);
}
stmt.fetchAll( function(rs, dbError) {
logger.info('rs is...');
logger.info(JSON.stringify(rs));
logger.info('dbError is...');
logger.info(JSON.stringify(dbError));
if(dbError !== undefined) {
stmt.close();
pool.release(connection);
return respondSqlError(res, sql, 'FetchAll Error: ' + dbError);
}
Comments (3)
-
Account Deactivated -
reporter Hey @mengxumx, 1.0.10 fixes the issue. Thanks!
-
Account Deactivated - changed status to resolved
v1.0.10 fixed it
- Log in to comment
Hello @krisbaehr , Would you try the v1.0.10 version please? I have seen this before but can not remember which code change fix it.