A JavaScript (Node.js) library for communicating with Db2 for IBM i, with support for queries, procedures, and much more. Uses traditional callback-style syntax
MIT License
37
stars
23
forks
source link
[dbstmt] retrieve data when SQLFetch return SQL_SUCCESS_WITH_INFO #71
If SQLExecDirect() return SQL_SUCCESS_WITH_INFO, it means the data is not in the query result set, we need to fetch it by ourselves.
If SQLFetch() return SQL_SUCCESS_WITH_INFO, currently I just treat it the same as SQL_SUCCESS and retrieve the data directly.
Test result seems OK --
-bash-4.4$ node idb-fetch-withinfo.js
This works---------------------------------------------
sql: select name
, sum(case hasSpecAttr when '1' then 1 else 0 end) cnt
from xumeng.article
group by name
result: [
{
"NAME": "Article1 ",
"CNT": "1"
}
]
error: null
This does NOT work---------------------------------------------
sql: select name
, count(case hasSpecAttr when '1' then 1 else null end) cnt
from xumeng.article
group by name
result: [
{
"NAME": "Article1 ",
"CNT": "1"
}
]
error: null
Signed-off-by: mengxumx mengxumx@cn.ibm.com
Related issue: #68 @jasonclake
SQLExecDirect()
returnSQL_SUCCESS_WITH_INFO
, it means the data is not in the query result set, we need tofetch
it by ourselves.SQLFetch()
returnSQL_SUCCESS_WITH_INFO
, currently I just treat it the same asSQL_SUCCESS
and retrieve the data directly.Test result seems OK --