Skip to content

Query

Simplified query functionality, accepts SQL script and query parameters and returns the result-set as a JSON object.

Basic Usage

import { query } from "sdk/db";
import { response } from "sdk/http";

const sql = "SELECT * FROM DIRIGIBLE_EXTENSIONS WHERE EXTENSION_EXTENSIONPOINT_NAME = ?";
let resultset = query.execute(sql, ["ide-editor"], "SystemDB");

response.println(JSON.stringify(resultset));

response.flush();
response.close();

Functions


Function Description Returns
execute(sql, parameters?, datasourceName?) Executes a SQL query against the selected datasourceName with the provided parameters result-set as JSON object

parameters array supports primitives e.g. [1, 'John', 34.56] or objects in format {'type':'[DATA_TYPE]', 'value':[VALUE]} e.g. [1, {'type':'CHAR', 'value':'ISBN19202323322'}]