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.hasMoreRows(c1)) { var objrecords = pjsc1.fetch(c1, 50); for (var i = 0; i < pjsc1.rowCount(c1); i++) { var record = console.log(objrecords[i]); }console.log(record); } } } pjsc1.close(c1); pjs.disconnect() |