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

Example of using stmtError() #31

Closed
abmusse opened this issue Jun 1, 2018 · 2 comments
Closed

Example of using stmtError() #31

abmusse opened this issue Jun 1, 2018 · 2 comments
Labels
bug Something isn't working trivial

Comments

@abmusse
Copy link
Member

abmusse commented Jun 1, 2018

Original report by Kristopher Baehr (Bitbucket: krisbaehr, GitHub: krisbaehr).


Are there any examples available for calling stmtError()? Thanks!

@abmusse
Copy link
Member Author

abmusse commented Jun 6, 2018

Original comment by Xu Meng (Bitbucket: mengxumx, GitHub: dmabupt).


@krisbaehr , you can use the stmtError() or the error parameter to print the error messages --

#!javascript
function exec(sql){
  console.log("\n[SQL]:" + sql);
  stmt.exec(sql, function(rs, err) {
    if(err) {
      console.log("[error]:" + err);
      stmt.stmtError(db.SQL_HANDLE_STMT, 1, (rs) => {console.log("[stmtError]:" + rs);});
    }
    else
      console.log(rs);
    stmt.closeCursor();
  });
}
#!shell

bash-4.4$ node 0818-db2_error_msg.js
[SQL]:SELECT * FROM UNKNOWN.NOTTHERE
[error]:SQLSTATE=42704 SQLCODE=-204 NOTTHERE in UNKNOWN type *FILE not found.
[stmtError]:SQLSTATE=42704 SQLCODE=-204 NOTTHERE in UNKNOWN type *FILE not found.

@abmusse
Copy link
Member Author

abmusse commented Jun 22, 2018

Original comment by Kristopher Baehr (Bitbucket: krisbaehr, GitHub: krisbaehr).


Thanks @dmabupt .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working trivial
Projects
None yet
Development

No branches or pull requests

1 participant