node-odbc icon indicating copy to clipboard operation
node-odbc copied to clipboard

[BUG] callProcedure() does not put the return value in the results object

Open brandonp42 opened this issue 1 year ago • 4 comments

Describe your system

  • odbc Package Version: 2.4.8
  • unixODBC version: 2.3.9-1
  • ODBC Driver: IBM i Access ODBC Driver 1.1.0.27-0
  • Database Name: DB2 for i
  • Database Version: IBM i 7.4
  • Database OS: IBM i 7.4
  • Node.js Version: v18.18.2
  • Node.js OS: IBM i 7.4

Describe the bug When calling stored procedures with callProcedure(), the return value is not populated into the results object. Instead it's just undefined.

Expected behavior The results object property "return" should have the return value from the stored procedure.

Code to reproduce SQL to create an example stored procedure:

CREATE OR REPLACE PROCEDURE NODEODBC.test_return (
  INOUT message       varchar(128)
)
LANGUAGE SQL
BEGIN
  set message = 'goodbye';
  return 42;
END;

NodeJS code:

import odbc from 'odbc';

let conn = await odbc.connect('DSN=*LOCAL');

let parameters = ['hi there'];
let result = await conn.callProcedure(null, 'NODEODBC', 'TEST_RETURN', parameters);

console.log(result);

Results from NodeJS:

node stored-proc-return-value.js
[
  statement: '{ CALL NODEODBC.TEST_RETURN (?) }',
  parameters: [ 'goodbye' ],
  return: undefined,
  count: 0,
  columns: []
]

Results from ACS Run SQL scripts:

call NODEODBC.test_return('hi there');

[ 02/06/2024, 11:20:41 AM ]  Run Selected...
call NODEODBC.test_return('hi there')
Return Code = 42
Output Parameter #1 (MESSAGE) = goodbye
Statement ran successfully   (2 ms)

brandonp42 avatar Feb 06 '24 18:02 brandonp42

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 07 '24 01:05 stale[bot]

Still an issue/question

brandonp42 avatar May 07 '24 02:05 brandonp42

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 05 '24 07:08 stale[bot]

Still an open issue/question

brandonp42 avatar Aug 05 '24 22:08 brandonp42