Database Update
Simplified update functionality, accepts SQL script and query parameters and returns the result-set as a JSON object.
Version 3.x
- Module: db/v3/update
- Alias: db/update
- Definition: https://github.com/eclipse/dirigible/issues/49
- Source: /db/v3/update.js
- Facade: DatabaseFacade
- Status: alpha
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