Database Update

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

Version 3.x

Basic Usage

1
2
3
4
5
6
var update = require('db/v3/update');

update.execute("CREATE TABLE MY_TABLE (COLUMN_A INT, COLUMN_B VARCHAR(10))");
update.execute("INSERT INTO MY_TABLE VALUES (1, 'ABC')");
update.execute("INSERT INTO MY_TABLE VALUES (2, 'DEF')");
update.execute("DROP TABLE MY_TABLE");

Definition

Functions


Function Description Returns
execute(sql, parameters?, databaseType?, datasourceName?) Executes a SQL update against the selected databaseType and datasourceName with the provided parameters and returns the number of affected rows int

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’}]

Compatibility

Rhino Nashorn V8


Edit