Update
Simplified update functionality, accepts SQL script and query parameters and returns the result-set as a JSON object.
- Module:
db/v4/update
- Alias:
db/update
- Definition: https://github.com/eclipse/dirigible/issues/49
- Source: /db/v4/update.js
- Facade: DatabaseFacade
- Status:
stable
Basic Usage
var update = require("db/v4/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");
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'}]