Section | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
Info |
---|
This API can accept an optional database connection definition object to select between multiple database connections. To select the database connection, call pjs.getDB() and pass the result as the first parameter, followed by the parameters documented below. If a database connection definition object is not passed, the default database connection is used. |
- Database Connection (optional/omittable)
Pass an object returned by pjs.getDB() to use an alternate database connection. If not passed, the default connection will be used. - Query Options (optional/omittable)
Pass an object containing statement attributes to set before executing the query. - 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). This parameter is applicable only for an INSERT statement.
...
- 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.
Info | ||
---|---|---|
| ||
16MB of data is the limit for the whole result from a pjs.query() request with the IBM i Connector. (The limit is not 16MB per column). |
Examples
Load a Grid
Code Block | ||||
---|---|---|---|---|
| ||||
pjs.defineDisplay("display", "mydisplay.json"); var records = pjs.query("SELECT * FROM ORDERS"); display.grid1.replaceRecords(records); |
...