datasource.select deprecated
Runs a SELECT statement against a datasource and returns the rows as a JSON string.
Deprecated
Use datasource.client(datasource).select(query, params) instead.
js
datasource.select(datasource, query, parameters, extended)Parameters
| Parameter | Type | Description |
|---|---|---|
datasource | string | The datasource's name. It must be a JDBC datasource. |
query | string | The SELECT statement. Use ? placeholders for values. |
parameters | string[] | Optional. Values for the ? placeholders, in order. |
extended | boolean | Optional. true to include the returned columns' data types and details. |
Returns
stringThe rows as a JSON string, with every value as a string. Read it with JSON.parse().
Examples
js
const rows = JSON.parse(datasource.select("Internal Datastore", "SELECT department_id, department_name FROM department_codes;"));