This API closes a defined handle.
You should close every handle in your module after you've finished using it. However, if a handle is not closed, Profound.js will automatically attempt to close all open handles when an error occurs or when the Profound.js module exits.
The API can also be called in the form of a method attached to a statement handle object as follows: stmt.close().
Parameter
- Handle created from pjs.prepare() or pjs.executeDirect(). This parameter can be omitted if the API is called as a statement method.
Exception Handling
SQL diagnostics are reported in the SQLCA:
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/db2/rbafzfielddescsqlca.htm
SQLCA fields are defined in Profound.js programs with the names in lowercase. sqlcode will be set to zero if execution was successful.
Examples
Code Block | ||||
---|---|---|---|---|
| ||||
var handle = pjs.allocStmt(); pjs.executeDirect(handle, "SELECT * FROM PJSTEST/PRODUCTSP"); //... pjs.close(handle); |
Code Block | ||||
---|---|---|---|---|
| ||||
var handle = pjs.allocStmt(); handle.executeDirect("SELECT * FROM PJSTEST/PRODUCTSP"); //... handle.close(); |
Requirements
When using an IBM i database, this API requires the Profound.js Connector module.