Page tree
Skip to end of metadata
Go to start of metadata

This API allocates a statement handle.

Using a statement handle, you can set statement attributes, execute SQL statements, and fetch data.

Return Value

The API returns a handle, which can be used again in other statements.

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.

Example
var c1 = pjs.allocStmt();

// Example of passing a handle to an API
pjs.setStmtAttr(c1, SQL_ATTR_CURSOR_SCROLLABLE, SQL_TRUE);
 
// Example of using a handle's method
c1.setAttr(SQL_ATTR_CURSOR_SCROLLABLE, SQL_TRUE);


Requirements

When using an IBM i database, this API requires the Profound.js Connector module.