← All procedures
sqlite.openDatabase
This function opens a database, and makes the file when it is not there. `:memory:` gives a database with no file. With `readOnly`, the file must exist.
MCPCLI- Package
- @procedures/sqlite · README
- Path
["sqlite","openDatabase"]- CLI
mark sqlite openDatabase --path <string>- MCP tool
sqlite.openDatabase on the dev-tools server- As data
{"$proc":["sqlite","openDatabase"],"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","openDatabase"], { path: "<path>" });
console.log(JSON.stringify(result));From the command line
$ mark sqlite openDatabase --path <string>
As data, in a program
{ "$proc": ["sqlite", "openDatabase"], "input": { "path": "<path>" } }Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "The path of the file, or `:memory:`."
},
"options": {
"type": "object",
"properties": {
"wal": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "string",
"const": "when-writable"
}
],
"description": "This value turns on the write-ahead log (WAL). The default is true. Then readers do not stop a writer. A database with no file keeps its journal in memory."
},
"readOnly": {
"type": "boolean",
"description": "This value opens the file to read only. The default is false. The file must exist. The open does not change the journal mode, and each write throws. Do not give `wal: true` or `makeFolder: true` with it."
},
"synchronous": {
"type": "string",
"enum": [
"EXTRA",
"FULL",
"NORMAL",
"OFF"
],
"description": "This value is the pragma `synchronous`. The default is `FULL`: a commit is on the disk when the call ends. With WAL, `NORMAL` can lose the last commits at a power cut, and the file stays good. On a connection with `NORMAL`, `syncedTransaction` gives the sync of `FULL` to one commit."
},
"busyTimeoutMs": {
"type": "number",
"description": "This value is the time in milliseconds that a statement waits for the lock of a different connection. The default is 0: then the statement fails at once with \"database is locked\"."
},
"makeFolder": {
"type": "boolean",
"description": "This value makes the folder of the file when the folder is not there. The default is false."
},
"folderMode": {
"type": "number",
"description": "This value is the mode of the folders that `makeFolder` makes, for example `0o700`."
}
},
"additionalProperties": {},
"description": "The pragmas and the folder."
}
},
"required": [
"path"
],
"additionalProperties": false
},
"output": {
"type": "object",
"properties": {
"handle": {
"type": "string",
"minLength": 1,
"description": "The id of the handle. The procedure that opens the object gives it."
}
},
"required": [
"handle"
],
"additionalProperties": false,
"x-procedures-handle": "node:sqlite#DatabaseSync",
"description": "A handle of a node:sqlite#DatabaseSync. The procedure that opens it gives it, and handle.close closes it."
}
}