datasource.insert deprecated
Runs an INSERT statement against a datasource and returns the new row's key.
Deprecated
Use datasource.client(datasource).execute(statement, params) instead.
js
datasource.insert(datasource, query, parameters)Parameters
| Parameter | Type | Description |
|---|---|---|
datasource | string | The datasource's name. It must be a JDBC datasource. |
query | string | The INSERT statement. Use ? placeholders for values. |
parameters | string[] | Values for the ? placeholders, in order. |
Returns
numberThe key generated for the new row, or 0 when there isn't one.
Examples
js
const id = datasource.insert("Internal Datastore", "INSERT INTO department_codes (department_id, department_name) VALUES (?, ?);", ["001", "Head Office"]);