← All procedures
sqlite.transaction
Run statements in one transaction: they all take effect, or none does
CLI- Package
- @procedures/sqlite · README
- Path
["sqlite","transaction"]- CLI
mark sqlite transaction --statements <object[]>- As data
{"$proc":["sqlite","transaction"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/sqlite/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["sqlite","transaction"], { statements: [] });
console.log(JSON.stringify(result));From the command line
$ mark sqlite transaction --statements <object[]>
As data, in a program
{ "$proc": ["sqlite", "transaction"], "input": { "statements": [] } }Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"statements": {
"minItems": 1,
"type": "array",
"items": {
"type": "object",
"properties": {
"sql": {
"type": "string",
"minLength": 1,
"description": "One SQL statement, or several without params. BEGIN, COMMIT and ROLLBACK are refused."
},
"params": {
"description": "The values of the ? placeholders, in order",
"type": "array",
"items": {}
}
},
"required": [
"sql"
]
},
"description": "The statements, in order: they all take effect, or none does"
},
"dbPath": {
"description": "The SQLite database file (default: the CLI log database, ~/logs/cli/cli.db)",
"type": "string",
"minLength": 1
}
},
"required": [
"statements"
]
},
"output": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"changes": {
"type": "number",
"description": "The rows that the statement changed"
},
"rows": {
"description": "The rows of a statement that gives rows (SELECT, or RETURNING)",
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
}
}
},
"required": [
"changes"
],
"additionalProperties": {}
},
"description": "One result for each statement of the input"
},
"changes": {
"type": "number",
"description": "The rows that the transaction changed"
}
},
"required": [
"results",
"changes"
],
"additionalProperties": {}
}
}