Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Parameter
  1. SQL statement string
  2. Cursor name

Return Value

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

...

Code Block
languagejavascript
pjs.define("productsp_out", { type: 'data structure', qualified: true, dim: 50, elements: {
  "prid": { type: "packed decimal", length: 5, decimals: 0, initValue: 105 },
  "prname": { type: "char", length: 30 },
  "prdesc": { type: "char", length: 60 }
}})
 
pjs.define("searchQuery", { type: "char", length: 30 });
 
var c1;
pjs.connect("*LOCAL");
pjs.clear(productsp_out);


searchQuery = '%' + 'Garmin' + '%';
c1 = pjs.prepare("select prid, prname, prdesc from demolib/productsp where prdesc like ? order by prid", "c1");
pjs.bindParameters(c1, [
  [searchQuery.trim(), pjs.SQL_PARAM_INPUT]
]);
pjs.execute(c1);
 
pjs.fetch(c1, productsp_out, 50);
 
pjs.close(c1);
pjs.disconnect();

...