Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dbstmt] retrieve data when SQLFetch return SQL_SUCCESS_WITH_INFO #71

Merged
merged 1 commit into from
Apr 1, 2019

Conversation

dmabupt
Copy link
Contributor

@dmabupt dmabupt commented Mar 27, 2019

Signed-off-by: mengxumx mengxumx@cn.ibm.com

Related issue: #68 @jasonclake

  • 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>
@dmabupt dmabupt self-assigned this Mar 27, 2019
@dmabupt dmabupt requested review from ThePrez and abmusse March 27, 2019 07:11
Copy link
Member

@ThePrez ThePrez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dmabupt dmabupt merged commit f8d330a into master Apr 1, 2019
@dmabupt dmabupt deleted the dmabupt-patch-2 branch April 1, 2019 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants