Versions Compared

Key

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


This method indicates whether the end of data has been reached for the most recent fetch of a statement handle. It is the opposite of pjs.hasMoreRows().

Return Value

Boolean true if the last row was returned from the most recent fetch. False is returned if the last row was not returned, if the statement handle does not reference a SELECT statement, or if the statement has not been successfully executed and fetched from.

Example
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

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