Versions Compared

Key

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

...

Code Block
languagejs
titleUsing pjs.query()
let name = "Acme Corporation";
let address = "123 Main St.";
let row = pjs.query("select * from new table(insert into customer(name, address) values(?, ?))", [name, address]);

Or:

Code Block
languagejs
titleUsing pjs.prepare()/pjs.execute()/pjs.fetch()
  pjs.define("name", { type: "varchar", length: 20 });
  pjs.define("address", { type: "varchar", length: 20 });
  name = "Acme Corporation";
  address = "123 Main St.";
  let row;
  let stmt = pjs.prepare("select * from new table(insert into customer(name, address) values(?, ?))");
  if (sqlcode === 0) {
    pjs.bindParameters(stmt, [[name, SQL_PARAM_INPUT], [address, SQL_PARAM_INPUT]]);
  }
  if (sqlcode === 0) {
    pjs.execute(stmt);
  }
  if (sqlcode === 0) {
    row = pjs.fetch(stmt);
  }

...