-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hi,
The executeSync() function appears to fail when the bind parameter is enclosed to a SQL function (UPPER() in our case).
The documentation report a deprecated function bindParametersSync() remplaced by bindParameterSync() -> we kept bindParametersSync() as bindParameterSync() isn't recognise in the version we use.
Node.js version: v20.5.1
idb-connector version: v1.2.19
IBM i version: 4 7
import pkg from 'idb-connector';
const { dbconn: idbconn, dbstmt: dbstmt } = pkg;
// Original query
const sSql = "SELECT TRIM(TEXT_DESCRIPTION) AS NAME FROM QSYS2.USER_INFO SYS WHERE AUTHORIZATION_NAME = UPPER(?)";
// Alternative
//const sSql = "SELECT TRIM(TEXT_DESCRIPTION) AS NAME FROM QSYS2.USER_INFO SYS WHERE AUTHORIZATION_NAME = ?"
const connection = new idbconn();
connection.conn('*LOCAL');
const stmt = new dbstmt(connection);
// Username
const login = "po"; // your username
stmt.prepareSync(sSql);
// Original
stmt.bindParametersSync([login]);
// Alternative
//stmt.bindParametersSync([login.toUpperCase()]);
stmt.executeSync();
const row = stmt.fetchSync();
console.log(`Row:${JSON.stringify(row)}\n`);
console.log(row["NAME"]);
stmt.close();
connection.disconn();
connection.close();
Output:
stmt.executeSync();
^
Error: SQLSTATE=58004 SQLCODE=-901 Erreur système SQL.
Describe the bug
The executeSync() function appears to fail when the bind parameter is enclosed to a SQL function (UPPER() in our case).
To Reproduce
Steps to reproduce the behavior:
- copy paste provided code, adapt the login variable
- run in a node idb-connector environment
- uncomment/comment Alternative/Original scenario to see success/fail output
Thank you
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working