Example of using stmtError()

Issue #30 resolved
Kristopher Baehr created an issue

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

Comments (4)

  1. mengxumx Account Deactivated

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

    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();
      });
    }
    
    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.
    
  2. Log in to comment