executeSync callback called twice, v6.11.5
Issue #16
resolved
I believe a bug was introduced in v6.11.5
that wasn't there in v6.9.1
. This issue was found when calling RPG from iToolkit.js
using the synchronous approach.
Vanilla sample program:
let db = require('/QOpenSys/QIBM/ProdData/OPS/Node6/os400/db2i/lib/db2a')
let conn = new db.dbconn();
conn.setConnAttr(db.SQL_ATTR_DBC_SYS_NAMING , db.SQL_FALSE);
conn.conn("*LOCAL");
let stmt = new db.dbstmt(conn);
stmt.prepareSync("call QXMLSERV.iPLUG512K(?,?,?,?)");
let xmlOut;
stmt.bindParamSync([
["*NA", db.SQL_PARAM_INPUT, 1],
["*here", db.SQL_PARAM_INPUT, 1],
["<?xml version='1.0'?><myscript><cmd exec='rexx' error='fast'>RTVJOBA USER(?)</cmd></myscript>", db.SQL_PARAM_INPUT, 0],
[xmlOut, db.SQL_PARAM_OUTPUT, 0],
]);
stmt.executeSync(outArray => {
delete stmt;
conn.disconn();
delete conn;
console.log('outArray: ' + outArray)
});
Output:
outArray: <?xml version='1.0'?><myscript><cmd exec='rexx' error='fast'><success>+++ success RTVJOBA USER(?)</success>
<row>
<data desc='USER'>QUSER</data>
</row>
</cmd>
</myscript>
outArray: undefined <--------- the second callback that should not happen
This same code works with v6.9.1
.
I reviewed dbstmt.cc
and see two callbacks in Execute(...), but I believe only one can be reached. This leads me to believe I don't have the correct version of source.
Comments (6)
-
Account Deactivated -
reporter Maybe I should merge the two callbacks into one, and pass the output binding parameter (if available) and the result set (if available) together.
That sounds like a good idea to me.
-
Account Deactivated Fixed in commit 6b973dc
-
@aaronbartell, can we mark this resolved?
-
-
assigned issue to
Assigning to @aaronbartell for verification
-
assigned issue to
-
reporter - changed status to resolved
- Log in to comment
Hello Aaron, The callback should not be exectued twice. Maybe I should merge the two callbacks into one, and pass the output binding parameter (if available) and the result set (if available) together.