The following example selects reads records from a file row-by-row, a table one at a time into a primitive JavaScript object.:
Code Block | ||
---|---|---|
| ||
pjs.connect("*LOCAL"); var c1 = pjs.allocStmt(); pjs.executeDirect(c1, "selectSELECT prid, prname, prdesc fromFROM demolib/productsp orderORDER byBY prid"); if (SQLSTATEsqlstate == '00000') { var obj = pjsc1.fetch(c1); while (SQLSTATE == '00000'(c1.hasMoreRows()) { console.log(obj); obj = pjsc1.fetch(c1); } } pjsc1.close(c1); pjs.disconnect(); |