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 12 Next »

This API binds parameters to a prepared statement.

Before using this API, you must call pjs.prepare(), so that you can pass in the handle from that call.

Parameters
  1. The handle created by pjs.prepare().
  2. An array of parameters for each SQL parameter marker. Each element in the array must be another array, where the first element is the value of the parameter and the second is the parameter type. For example:
    • [[paramA, SQL_PARAM_INPUT], [paramB, SQL_PARAM_INPUT]]
Example
var table = "productsp";
 
pjs.define("productsp_out", { type: 'data structure', qualified: true, dim: 50, extName: table  });
pjs.define("searchQuery", { type: "char", length: 30 });
  
var c1;
pjs.connect("*LOCAL");
pjs.clear(productsp_out);
 
searchQuery = '%' + 'Garmin' + '%';
c1 = pjs.prepare("select * from " + table  + " where prdesc like ? order by prid");
pjs.bindParameters(c1, [
  [searchQuery.trim(), pjs.SQL_PARAM_INPUT]
]);
pjs.execute(c1);
 
pjs.fetch(c1, productsp_out, 50);
 
pjs.close(c1);
pjs.disconnect();


Requirements

This API requires the Profound.js Connector module.

  • No labels