Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 7 Next »

This API executes a prepared statement. It should be be called after parameter binding.

The API can also be called in the form of a method attached to a statement object as follows: stmt.execute().

Parameters
  1. Handle from a prepared statement. This parameter can be omitted if the API is called as a statement method.

Exception Handling

An Error instance will be thrown with the following properties:

  • message - The IBM i message text.
  • error - The message id.
  • help - The message help text.
Example
Called directly
var searchTerm = '%' + search + '%';
var sql = 'SELECT * FROM products WHERE prname LIKE ? OR prdesc LIKE ?';

var c1 = pjs.prepare(sql);
pjs.setStmtAttr(c1, SQL_ATTR_CURSOR_SCROLLABLE, SQL_TRUE);
pjs.bindParameters(c1, [searchTerm, searchTerm]);

pjs.execute(c1);
Called as a method
var searchTerm = '%' + search + '%';
var sql = 'SELECT * FROM products WHERE prname LIKE ? OR prdesc LIKE ?';

var c1 = pjs.prepare(sql);
c1.setAttr(SQL_ATTR_CURSOR_SCROLLABLE, SQL_TRUE);
c1.bindParameters([searchTerm, searchTerm]);

c1.execute();


Requirements

This API requires the Profound.js Connector module.

  • No labels