Closed jasonclake closed 5 years ago
@jasonclake I found something interesting -- you can reproduce the error only when you enable debug(true)
Makes sense if SQLError() is destructive -- Maybe just a doc update to idb-connector stmtError calling out the debug issue?
My fault -I read into the SQLError CLI doc that you could call SQLError multiple times since it says "before any function other than". Whereas SQLGetDiagRec() specifically says calling it clears the diagnostic info.
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/cli/rzadpfnerror.htm If diagnostic information generated by one DB2 for i CLI function is not retrieved before a function other than SQLError() is called with the same handle, the information for the previous function call is lost.
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/cli/rzadpfndrec.htm Diagnostic information stored under a given handle is cleared when a call is made to SQLGetDiagRec() with that handle, or when another DB2 for i CLI function call is made with that handle.
idb-connector v1.2.1 has updated the doc to indicate that dbstmt.stmtError() may not work properly when using with dbconn.debug(true). Close this issue now.
In the example below: I expected stmtError() to return the same string as the error from the statement.exec() function. But the error was no where to be found.
I know it seems redundant but we have a bigger agenda What we actually want is to retrieve an SQLError Object/s without having to parse the string/s. This was just preliminary testing.
Code Example:
Output: