← All procedures

sqlite.checkIntegrity

This function does the integrity check of SQLite on a connection. A file that is not a database gives a problem, not an error. A different error, for example a lock that is not free, goes to the caller.

MCPCLI
Package
@procedures/sqlite · README
Path
["sqlite","checkIntegrity"]
CLI
mark sqlite checkIntegrity --db <object>
MCP tool
sqlite.checkIntegrity on the dev-tools server
As data
{"$proc":["sqlite","checkIntegrity"],"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","checkIntegrity"], { db: {} });
console.log(JSON.stringify(result));

From the command line

$ mark sqlite checkIntegrity --db <object>

As data, in a program

{ "$proc": ["sqlite", "checkIntegrity"], "input": { "db": {} } }

Input

FieldTypeRequiredDefaultDescription
dbobjectyesThe connection. A handle of a node:sqlite#DatabaseSync. The procedure that opens it gives it, and handle.close closes it.
optionsobjectnoThe kind of check and the highest count of problems.

Output

FieldTypeRequiredDefaultDescription
okbooleanyesThis value is `true` when the check found no problem.
problemsstring[]yesThis list has the text of each problem that the check found, up to the limit of the check. A file that is not a database gives one problem. The list is empty when `ok` is `true`.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "db": {
        "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": "The connection. A handle of a node:sqlite#DatabaseSync. The procedure that opens it gives it, and handle.close closes it."
      },
      "options": {
        "type": "object",
        "properties": {
          "quick": {
            "type": "boolean",
            "description": "This value selects `PRAGMA quick_check`. It is faster, but it does not compare the indexes with their tables. The default is `false`."
          },
          "limit": {
            "type": "number",
            "description": "This value is the highest count of problems that the check gives. The default is 100."
          }
        },
        "additionalProperties": {},
        "description": "The kind of check and the highest count of problems."
      }
    },
    "required": [
      "db"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "ok": {
        "type": "boolean",
        "description": "This value is `true` when the check found no problem."
      },
      "problems": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "This list has the text of each problem that the check found, up to the limit of the check. A file that is not a database gives one problem. The list is empty when `ok` is `true`."
      }
    },
    "required": [
      "ok",
      "problems"
    ],
    "additionalProperties": {}
  }
}