Skip to content

datasource.select deprecated ​

Runs a SELECT statement against a datasource and returns the rows as a JSON string.

js
datasource.select(datasource, query, parameters, extended)

Parameters ​

ParameterTypeDescription
datasourcestringThe datasource's name. It must be a JDBC datasource.
querystringThe SELECT statement. Use ? placeholders for values.
parametersstring[]Optional. Values for the ? placeholders, in order.
extendedbooleanOptional. true to include the returned columns' data types and details.

Returns ​

string

The 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;"));