...
- SQL statement string
The SQL statement must be valid for the database you are using - parameter or array of parameters to bind (optional)
- number of records to fetch (optional)
This parameter only works with the IBM i DB2 database driver.
If omitted,SQL_FETCH_ALL
is assumed. - one or more Profound.js strongly typed field names (optional)
This parameter only works with the IBM i DB2 database driver.
If field names are passed, they will be bound to columns in the resulting rows and populated by this API if the fetch is successful. - number of rows per INSERT SQL request on a multi-insert action (optional; if not specified, the default is 100; available in Profound.s version 5.2.0)
Return Value
- If parameter 4 is specified, the API does not return a value.
- If 1 record is requested, the API returns a JavaScript object that represents the fetched record or null if no record was found.
- If more than 1 record is requested, the API returns an array of JavaScript objects, where each Object represents a record. If no records were fetched, an empty array is returned.
...
Code Block | ||
---|---|---|
| ||
var record1 = {flda: "AAA", fldb: "BBB"}; var record2 = {flda: "XXX", fldb: "YYY"}; var recordArray = [record1, record2] ; // 5th parameter is not specified, so default of 100 is used; there will be 100 rows per INSERT SQL request pjs.query("INSERT INTO table SET ?", recordArray); // 5th parameter is specified as 50, so there will be 50 rows per INSERT SQL request pjs.query("INSERT INTO table SET ?", recordArray, null, null, 50); |
Add a Record
Code Block | ||
---|---|---|
| ||
var version = "12345"; var record = {}; record.OneField = version; // variable record.TwoField = data[1].__SOMEFIELD; // object property record.RedField = "Suspended"; // literal record.BlueField = cvtDate (data[1].DUEDATE); // function call pjs.query ("INSERT INTO table SET ?", record) |
...