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 Page History

« Previous Version 18 Next »

This API prepares a statement to execute.

You only need to prepare a statement if you have parameter markers, identified by ? (question mark) symbols, in the SQL. You may use pjs.executeDirect() otherwise.

Parameter
  1. SQL statement string

Return Value

This method will return a handle which much be used again in other statements.

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
var table = "productsp";
 
pjs.define("productsp_out", { type: 'data structure', qualified: true, dim: 50, extName: table  });
pjs.define("searchQuery", { type: "char", length: 30 });
 
pjs.clear(productsp_out);

searchQuery = '%' + 'Garmin' + '%';
var c1 = pjs.prepare("SELECT * FROM productsp WHERE prdesc LIKE ? ORDER BY prid");
c1.bindParameters(searchQuery.trim());
c1.execute();
 
pjs.fetch(c1, productsp_out, 50);
 
c1.close();


Requirements

This API requires the Profound.js Connector module.

  • No labels