The following example selects reads records from a file table 50 rows at a time , into a primitive JavaScript object.:
Code Block | ||
---|---|---|
| ||
pjs.connect("*LOCAL"); var c1 = pjs.allocStmt(); pjsc1.executeDirect(c1, "selectSELECT prid, prname, prdesc fromFROM demolib/productsp orderORDER byBY prid", "c1"); var obj; if (SQLSTATEsqlstate == '00000') { while (!pjsc1.isLastRowhasMoreRows(c1)) { var records obj = pjsc1.fetch(c1, 50); for (var i = 0; i < pjsc1.rowCount(c1); i++) { var console.log(objrecord = records[i]); }console.log(record); } } } pjsc1.close(c1); pjs.disconnect() |