Versions Compared

Key

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

...

Code Block
languagejavascript
titleSelect all rows from SYSTABLES
pjs.define("systables", { type: "data structure", qualified: true, dim: 100, elements: {
  "table_name": { type: "char", varying: true, length: 128},
  "table_text": { type: "char", varying: true, length: 50 }
}});
   
var stmt = pjs.allocStmt();
stmt.executeDirect("select table_name, table_text from qsys2/systables");
var total = 0;
while (!stmt.endOfData()) {
  pjs.fetch(stmt, systables, 100);
  for (var idx = 1; idx <= stmt.rowCount(); idx++) {
    console.log("(%d) %s %s", total + idx, systables[idx].table_name, systables[idx].table_text);
  }
  total += stmt.rowCount();    
}
stmt.close();

 


Requirements

This When using an IBM i database, this API requires the Profound.js Connector module.