prorm API Reference
    Preparing search index...

    Class SQLiteDialect

    SQLite dialect class that implements the Dialect interface

    Implements

    Index
    connect disconnect getConnection isConnected replaceReplacements query queryStream escape buildJsonExtract buildJsonContains buildJsonHasKey buildJsonPathQuery buildJsonGroupArray buildJsonGroupObject buildJsonPatch escapeId quoteIdentifier quoteTable getDatabaseVersion createDatabaseSQL dropDatabaseSQL attachDatabase detachDatabase createSavepointSQL releaseSavepointSQL rollbackToSavepointSQL createTable dropTable createPartitionedTable createPartition attachPartition detachPartition dropPartition addPartition listPartitions hasPartition createUser dropUser listUsers createRole dropRole listRoles grant revoke addColumn removeColumn changeColumn showTables getTableStatus getCreateTable getMariaDBVersionInfo showConstraints showIndexes createSchema dropSchema showAllSchemas listSchemas vacuum analyze getDatabaseInfo createFTS5Table fullTextSearch createStoredProcedure dropStoredProcedure dropProcedure executeStoredProcedure hasStoredProcedure createProcedure createForeignDataWrapper dropForeignDataWrapper createForeignServer dropForeignServer createForeignTable changeOwner addConstraint removeConstraint createSecurityPolicy dropSecurityPolicy createTrigger dropTrigger hasTrigger createSequence dropSequence nextSequenceValue hasSequence listSequences createPolicy dropPolicy enableRLS enableRowLevelSecurity disableRLS hasPolicy commentTable commentColumn createPartialIndex createExpressionIndex createIdentityColumn createComputedColumn createExtension dropExtension getExtensions hasExtension buildCreateServerQuery buildAlterServerQuery buildDropServerQuery buildCreateUserMappingQuery buildAlterUserMappingQuery buildDropUserMappingQuery buildCreateForeignTableQuery buildDropForeignTableQuery buildImportForeignSchemaQuery getServersQuery createView dropView showViews createMaterializedView refreshMaterializedView dropMaterializedView hasMaterializedView showMaterializedViews describeTable renameTable addIndex removeIndex createIndex dropIndex createConstraint dropConstraint startTransaction commitTransaction rollbackTransaction getDataTypeSql buildWhereClause buildOrderClause buildLimitOffset buildInsertQuery buildUpsertQuery buildIncrementQuery buildUpdateQuery buildDeleteQuery buildWithClause buildSelectQuery buildCreateUserQuery buildAlterUserQuery buildDropUserQuery getUsersQuery buildGrantQuery buildRevokeQuery buildShowGrantsQuery buildFlushPrivilegesQuery buildCreateRoleQuery buildDropRoleQuery buildGrantRoleQuery buildRevokeRoleQuery getRolesQuery bulkInsert bulkUpdate bulkDelete addForeignKey setPragma renameColumn createFulltextIndex createSpatialIndex createUserMapping dropUserMapping stDistance stDWithin stWithin stContains stIntersects stAsText stGeomFromText buildJsonTable
    name: string = 'sqlite'

    The name of the dialect

    library: string = 'better-sqlite3'

    The database library or driver being used

    • Replace placeholders in SQL with actual values Supports both named (:param) and positional (?) placeholders

      Parameters

      • sql: string
      • Optionalreplacements: unknown[] | Record<string, unknown>

      Returns string

    • Stream query results using better-sqlite3's native Statement#iterate() — a real in-process cursor (no round trips at all, since sqlite is embedded), so this is more efficient than the generic paginated LIMIT/OFFSET fallback other dialects use.

      Parameters

      • sql: string

        The SELECT statement to stream

      • Optionaloptions: StreamOptions

        Streaming options (batch size only affects backpressure batching, not fetch round trips)

      Returns Readable

    • Build a JSON extraction query for SQLite SQLite: json_extract(column, '$.path')

      Parameters

      • column: string
      • path: string
      • asText: boolean = true

      Returns string

    • Build a JSON contains query for SQLite SQLite: uses json_each and json_extract for containment checks

      Parameters

      • column: string
      • value: unknown
      • Optionalpath: string

      Returns { sql: string; values: unknown[] }

    • Build a JSON has key query for SQLite SQLite: json_each or json_extract for key existence

      Parameters

      • column: string
      • key: string
      • type: "all" | "one" = 'one'

      Returns string

    • Build a JSON path query for SQLite

      Parameters

      • column: string
      • path: string
      • Optionalvalue: unknown
      • operator: string = '='

      Returns { sql: string; values: unknown[] }

    • Build a json_group_array() aggregate expression for SQLite.

      json_group_array() is SQLite's JSON1 aggregate for collecting the values of valueExpr (evaluated once per row in the current group) into a single JSON array. Commonly used for "hasMany as nested JSON" style queries, e.g. rolling up child rows into a JSON array column of a grouped parent query.

      Parameters

      • valueExpr: string

        a column name or SQL expression to collect per row. Bare identifiers are escaped as columns; anything containing SQL syntax (parens, function calls, .) is passed through as-is so callers can pass expressions like json_object('id', id).

      • Optionaloptions: { distinct?: boolean }
        • Optionaldistinct?: boolean

          emit json_group_array(DISTINCT ...)

      Returns string

    • Build a json_group_object() aggregate expression for SQLite.

      json_group_object() collects (keyExpr, valueExpr) pairs from the rows of the current group into a single JSON object, keyed by keyExpr. Useful for building a JSON map of { [key]: value } from grouped rows (e.g. nested-relation queries keyed by id).

      Parameters

      • keyExpr: string
      • valueExpr: string

      Returns string

    • Build a json_patch() expression for SQLite (RFC 7396 JSON Merge Patch).

      json_patch(target, patch) applies an RFC 7396 merge patch to the JSON stored in column, returning the patched JSON document. Unlike json_set() (which sets a single path) this can add, replace, and remove multiple keys in one call - keys in patch set to null are removed from the result.

      Parameters

      • column: string

        the JSON column to patch

      • patch: unknown

        a JS object/value to be JSON-stringified and applied as the merge patch; passed as a bound parameter, not interpolated.

      Returns { sql: string; values: unknown[] }

    • Quote a table name Same as escapeId for SQLite If schema is provided, returns schema.tableName (SQLite treats schemas as prefixes)

      Parameters

      • tableName: string
      • Optionalschema: string

      Returns string

    • Generate SQL for creating a database SQLite uses ATTACH DATABASE for creating new database files

      Parameters

      • options: {
            name: string;
            encoding?: string;
            lcCollate?: string;
            lcCtype?: string;
            template?: string;
            tablespace?: string;
            collate?: string;
            isTemplate?: boolean;
        }

      Returns string

    • Generate SQL for dropping a database SQLite uses DETACH DATABASE for dropping database files

      Parameters

      • name: string

      Returns string

    • Attach an external SQLite database file to the current connection under alias, making its tables reachable as alias.tableName in subsequent queries (cross-database queries/joins). Executes a real ATTACH DATABASE ? AS <alias> statement rather than just documenting the capability.

      Parameters

      • path: string

        filesystem path to the database file to attach (or :memory: for an attached in-memory database)

      • alias: string

        schema name subsequent SQL will use to refer to the attached database (e.g. alias.users)

      Returns Promise<void>

    • Detach a previously-attached database from the current connection. Executes a real DETACH DATABASE <alias> statement.

      Parameters

      • alias: string

        the schema name the database was attached under via attachDatabase()

      Returns Promise<void>

    • Create a new table

      Parameters

      • tableName: string
      • columns: Record<string, ColumnDefinition>
      • Optionaloptions: TableOptions & { strict?: boolean; withoutRowid?: boolean }
        • Optionalstrict?: boolean

          SQLite 3.37+ STRICT tables - enforces column type affinity strictly instead of SQLite's normally-flexible type system.

        • OptionalwithoutRowid?: boolean

          WITHOUT ROWID tables - opts a table out of the implicit rowid, storing rows in the order of the PRIMARY KEY instead. Useful for tables with a natural composite/text primary key.

      Returns Promise<void>

    • Create a partitioned table (SQLite emulation) Creates base table + child partition tables + union view

      Parameters

      • tableName: string
      • columns: Record<string, ColumnDefinition>
      • Optionaloptions: TableOptions & {
            partitionBy: {
                type: "key" | "range" | "list" | "hash";
                column: string | string[];
            };
            partitions?: | number
            | {
                name: string;
                bound?: any;
                tablespace?: string;
                storageParameters?: Record<string, string | number>;
            }[];
        }

      Returns Promise<void>

    • Drop a partition (SQLite emulation)

      Parameters

      • partitionName: string
      • Optionaloptions: { ifExists?: boolean; cascade?: boolean }

      Returns Promise<void>

    • Add a partition to an existing partitioned table (SQLite emulation)

      Parameters

      • tableName: string

        Name of the partitioned table

      • partitionName: string

        Name for the new partition

      • partitionSpec: { values?: string; forValues?: string }

        Partition specification

      Returns Promise<void>

    • List partitions for a table (SQLite emulation)

      Parameters

      • tableName: string

      Returns Promise<
          {
              name: string;
              parent_table: string;
              bound: string
              | null;
              is_detached: number;
          }[],
      >

    • Check if a table has partitions (SQLite emulation)

      Parameters

      • tableName: string

      Returns Promise<boolean>

    • Create a user (stub - not supported by SQLite)

      Parameters

      • _username: string
      • Optional_options: any

      Returns Promise<void>

    • Drop a user (stub - not supported by SQLite)

      Parameters

      • _username: string
      • Optional_options: any

      Returns Promise<void>

    • List users (stub - not supported by SQLite)

      Returns Promise<{ username: string; host: string }[]>

    • Create a role (stub - not supported by SQLite)

      Parameters

      • _roleName: string
      • Optional_options: any

      Returns Promise<void>

    • Drop a role (stub - not supported by SQLite)

      Parameters

      • _roleName: string
      • Optional_options: any

      Returns Promise<void>

    • Grant privileges (stub - not supported by SQLite)

      Parameters

      • _privilege: string
      • _on: string
      • _to: string

      Returns Promise<void>

    • Revoke privileges (stub - not supported by SQLite)

      Parameters

      • _privilege: string
      • _on: string
      • _from: string

      Returns Promise<void>

    • Remove a column from a table

      Parameters

      • tableName: string
      • columnName: string

      Returns Promise<void>

    • Get table status (SQLite implementation)

      Parameters

      • OptionaltableName: string

      Returns Promise<Record<string, any>[]>

    • Get table create statement (SQLite implementation)

      Parameters

      • tableName: string

      Returns Promise<string>

    • Get MariaDB-specific version info (not supported in SQLite) This method exists for compatibility when tests fall back to SQLite

      Returns Promise<{ version: string; versionNumber: number; storageEngine: string }>

    • Create a schema SQLite doesn't have native schema support, but we can use ATTACH DATABASE For now, this is a no-op for compatibility with other dialects

      Parameters

      • _schema: string

      Returns Promise<void>

    • Drop a schema SQLite doesn't have native schema support For now, this is a no-op for compatibility with other dialects

      Parameters

      • _schema: string
      • Optional_options: { ifExists?: boolean; cascade?: boolean }

      Returns Promise<void>

    • VACUUM the database - reclaims disk space and defragments

      Parameters

      • Optionaloptions: { schema?: string; shrinkTo?: number; analyze?: boolean }

        VACUUM options

      Returns Promise<void>

    • ANALYZE the database - updates statistics for query optimizer

      Parameters

      • Optionaltarget: string

        Optional table or index name

      Returns Promise<void>

    • Get database information using PRAGMA

      Returns Promise<
          {
              schemaVersion: number;
              userVersion: number;
              foreignKeys: boolean;
              journalingMode: string;
              synchronous: string;
              cacheSize: number;
              pageSize: number;
          },
      >

    • Create an FTS5 virtual table for full-text search

      Parameters

      • tableName: string
      • columns: { name: string; type?: string; notindexed?: boolean }[]
      • Optionaloptions: {
            tokenizer?: "porter" | "unicode61" | "trigram" | "ascii";
            content?: string;
            contentRowId?: string;
            prefix?: "all" | number[];
        }

      Returns Promise<void>

    • Perform full-text search

      Parameters

      • ftsTable: string
      • searchQuery: string
      • Optionaloptions: {
            columns?: string[];
            orderBy?: { column: string; desc?: boolean }[];
            limit?: number;
            offset?: number;
            highlight?: { before?: string; after?: string; column?: string };
            bm25?: boolean;
        }

      Returns Promise<QueryResult>

    • Create a stored procedure (SQLite - Not Supported)

      SQLite does not support stored procedures natively. However, you can achieve similar functionality using:

      1. Application-level code: Move business logic into your application code
      2. Views: For read-only operations
      3. Triggers: For automated responses to data changes
      4. FTS5 virtual tables: For full-text search operations
      5. SQLite ATTACH: Connect to another database that supports stored procedures

      Example workaround using application code:

      // Instead of:
      await db.executeStoredProcedure({ procedureName: 'calculateTotal', params: { orderId: 1 } });

      // Use application-level code:
      const total = await calculateTotal(orderId);

      Parameters

      Returns Promise<void>

    • Execute a stored procedure (SQLite - Not Supported)

      SQLite does not support stored procedures. To execute the equivalent logic, move the procedure's SQL statements into your application code.

      Example:

      // Instead of:
      const result = await db.executeStoredProcedure({
      procedureName: 'getUserOrders',
      params: { userId: 123 }
      });

      // Use a query directly:
      const result = await db.query(
      'SELECT * FROM orders WHERE user_id = ?',
      [123]
      );

      Parameters

      Returns Promise<QueryResult>

    • Check if a stored procedure exists (SQLite - Always Returns False)

      Since SQLite does not support stored procedures, this always returns false. If you are checking for a procedure in an attached database, use that database's native method instead.

      Parameters

      • _procedureName: string
      • Optional_schema: string

      Returns Promise<boolean>

    • Create a foreign data wrapper (SQLite - not supported)

      Parameters

      • _fdwName: string
      • Optional_options: { handler?: string }

      Returns Promise<void>

    • Drop a foreign data wrapper (PostgreSQL)

      Parameters

      • _fdwName: string
      • Optional_options: { ifExists?: boolean }

      Returns Promise<void>

    • Create a foreign server (PostgreSQL)

      Parameters

      • _serverName: string
      • _fdwName: string
      • Optional_options: { options?: Record<string, string>; ifNotExists?: boolean }

      Returns Promise<void>

    • Drop a foreign server (PostgreSQL)

      Parameters

      • _serverName: string
      • Optional_options: { ifExists?: boolean; cascade?: boolean }

      Returns Promise<void>

    • Create a foreign table (PostgreSQL)

      Parameters

      • _tableName: string
      • _columns: Record<string, { type: string }>
      • Optional_options: { serverName?: string; ifNotExists?: boolean }

      Returns Promise<void>

    • Change owner of a table or view

      Parameters

      • _newOwner: string
      • _tableName: string

      Returns Promise<void>

    • Add a constraint to a table

      Parameters

      • _tableName: string
      • _options: {
            type: "UNIQUE" | "PRIMARY KEY" | "FOREIGN KEY" | "CHECK";
            fields: string[];
            name?: string;
            references?: { table: string; fields: string[] };
            check?: string;
        }

      Returns Promise<void>

    • Remove a constraint from a table

      Parameters

      • _tableName: string
      • _constraintName: string

      Returns Promise<void>

    • Create a security policy (MSSQL Row-Level Security)

      Parameters

      • _policyName: string
      • _tableName: string
      • Optional_options: { predicate?: string }

      Returns Promise<void>

    • Drop a security policy (MSSQL Row-Level Security)

      Parameters

      • _policyName: string
      • _tableName: string

      Returns Promise<void>

    • Create a trigger

      Parameters

      • triggerName: string
      • timing: "BEFORE" | "AFTER" | "INSTEAD OF"
      • events: ("INSERT" | "UPDATE" | "DELETE")[]
      • tableName: string
      • body: string
      • Optionaloptions: { replace?: boolean; forEachRow?: boolean; whenCondition?: string }

      Returns Promise<void>

    • Drop a trigger

      Parameters

      • triggerName: string
      • Optionaloptions: { ifExists?: boolean }

      Returns Promise<void>

    • Parameters

      • triggerName: string
      • OptionaltableName: string

      Returns Promise<boolean>

    • Get next value from a sequence (simulated by inserting and getting last_insert_rowid)

      Parameters

      • sequenceName: string
      • Optionalschema: string

      Returns Promise<number>

    • Check if a sequence exists (simulated by checking if the sequence table exists)

      Parameters

      • sequenceName: string
      • Optionalschema: string

      Returns Promise<boolean>

    • List all sequences in the database (SQLite - simulated via tables)

      Returns Promise<string[]>

      Array of sequence names

    • Parameters

      • _tableName: string
      • Optional_schema: string

      Returns Promise<void>

    • Parameters

      • _tableName: string
      • Optional_schema: string

      Returns Promise<void>

    • Parameters

      • _tableName: string
      • Optional_schema: string

      Returns Promise<void>

    • Parameters

      • _policyName: string
      • _tableName: string

      Returns Promise<boolean>

    • Parameters

      • _tableName: string
      • _comment: string

      Returns Promise<void>

    • Parameters

      • _tableName: string
      • _columnName: string
      • _comment: string

      Returns Promise<void>

    • Parameters

      • tableName: string
      • indexName: string
      • fields: string[]
      • where: string
      • Optionaloptions: IndexOptions

      Returns Promise<void>

    • Parameters

      • tableName: string
      • indexName: string
      • expression: string
      • Optionaloptions: IndexOptions

      Returns Promise<void>

    • Parameters

      • _tableName: string
      • _columnName: string
      • Optional_options: {
            startWith?: number;
            incrementBy?: number;
            minvalue?: number;
            maxvalue?: number;
            cycle?: boolean;
        }

      Returns Promise<void>

    • Parameters

      • tableName: string
      • columnName: string
      • expression: string
      • Optionaloptions: { persisted?: boolean; type?: string }

      Returns Promise<void>

    • Check if a PostgreSQL extension is installed (not supported in SQLite)

      Parameters

      • _extensionName: string

      Returns Promise<boolean>

    • Parameters

      • _name: string
      • Optional_opts: { ifExists?: boolean; cascade?: boolean }

      Returns string

    • Parameters

      • _serverName: string
      • _user: string
      • Optional_opts: { ifExists?: boolean }

      Returns string

    • Parameters

      • _tableName: string
      • Optional_opts: { ifExists?: boolean; cascade?: boolean }

      Returns string

    • Create a database view (SQLite uses CREATE VIEW)

      Parameters

      • viewName: string

        Name of the view to create

      • query: string

        The SELECT query for the view

      • Optionaloptions: { replace?: boolean }

        View options

      Returns Promise<void>

    • Drop a database view

      Parameters

      • viewName: string

        Name of the view to drop

      • Optionaloptions: { ifExists?: boolean }

        Drop options

      Returns Promise<void>

    • Check if a materialized view exists - Not supported by SQLite

      Parameters

      • _viewName: string

      Returns Promise<boolean>

    • Show all materialized views - Not supported by SQLite

      Returns Promise<string[]>

    • Add an index to a table Supports partial indexes (WHERE) and expression indexes (SQLite 3.9.0+)

      Parameters

      • tableName: string
      • indexName: string
      • fields: string[] = []
      • Optionaloptions: IndexOptions

      Returns Promise<void>

    • Remove an index from a table

      Parameters

      • tableName: string
      • indexName: string

      Returns Promise<void>

    • Create an index on a table with full options support Supports partial indexes (WHERE) and expression indexes (SQLite 3.9.0+)

      Parameters

      • tableName: string
      • indexDef: {
            name: string;
            unique?: boolean;
            type?: string;
            using?: string;
            fields: string[];
            where?: string | WhereOptions;
            expression?: string;
        }

      Returns Promise<void>

    • Drop an index from a table

      Parameters

      • tableName: string
      • indexName: string
      • Optional_options: { ifExists?: boolean; cascade?: boolean }

      Returns Promise<void>

    • Create a constraint on a table Note: SQLite has limited ALTER TABLE support for constraints

      Parameters

      • tableName: string
      • constraintDef: {
            name: string;
            type: "UNIQUE" | "PRIMARY KEY" | "FOREIGN KEY" | "CHECK";
            fields?: string[];
            references?: {
                table: string;
                field: string;
                onDelete?: string;
                onUpdate?: string;
            };
            check?: string;
        }

      Returns Promise<void>

    • Drop a constraint from a table Note: SQLite has limited ALTER TABLE support for constraints

      Parameters

      • tableName: string
      • constraintName: string
      • Optional_options: { ifExists?: boolean; cascade?: boolean }

      Returns Promise<void>

    • Build a WHERE clause from a WhereOptions object

      Parameters

      • where: WhereOptions
      • Optionaloptions: { replacements?: Record<string, unknown> }

      Returns { sql: string; values: unknown[] }

    • Build an ORDER BY clause

      Parameters

      • order: Order
      • Optionaloptions: { replacements?: Record<string, unknown> }

      Returns string

    • Build a LIMIT/OFFSET clause

      Parameters

      • Optionallimit: string | number
      • Optionaloffset: string | number

      Returns string

    • Build an INSERT query

      Parameters

      • tableName: string
      • values: Record<string, unknown>
      • Optionaloptions: InsertOptions & { doNothing?: boolean; conflictTargets?: ConflictTarget[] }
        • OptionaldoNothing?: boolean

          Emit ON CONFLICT (...) DO NOTHING instead of DO UPDATE.

        • OptionalconflictTargets?: ConflictTarget[]

          Multiple chained ON CONFLICT clauses targeting different unique constraints, e.g. ON CONFLICT(a) DO NOTHING ON CONFLICT(b) DO UPDATE .... When provided, this takes precedence over conflictFields/doNothing.

      Returns { sql: string; values: unknown[] }

    • Build an UPSERT query (INSERT ... ON CONFLICT DO UPDATE) SQLite supports: INSERT OR REPLACE, INSERT OR IGNORE, and ON CONFLICT DO UPDATE

      Parameters

      • tableName: string
      • values: Record<string, unknown>
      • Optionaloptions: UpsertQueryOptions & { doNothing?: boolean; conflictTargets?: ConflictTarget[] }
        • OptionaldoNothing?: boolean

          Emit ON CONFLICT (...) DO NOTHING instead of DO UPDATE.

        • OptionalconflictTargets?: ConflictTarget[]

          Multiple chained ON CONFLICT clauses targeting different unique constraints, e.g. ON CONFLICT(a) DO NOTHING ON CONFLICT(b) DO UPDATE .... When provided, this takes precedence over conflictFields/doNothing.

      Returns { sql: string; values: unknown[] }

    • Build an increment query

      Parameters

      • tableName: string

        Table name

      • fields: string | string[] | Record<string, number>

        Fields to increment

      • where: WhereOptions

        Where clause

      • Optionaloptions: { by?: number }

        Query options (by: number)

      Returns { sql: string; values: unknown[] }

    • Build a WITH [RECURSIVE] name [(cols)] AS (query), ... clause from SelectOptions.cte. Nested SelectOptions queries are compiled via a recursive call to buildSelectQuery; raw SQL strings are used verbatim.

      SQLite uses unnumbered ? placeholders (unlike Postgres/MSSQL's numbered $n/@pN), so no placeholder renumbering is needed here - each CTE's values are simply concatenated in the order their ? markers appear in the rendered SQL, and the caller prepends the whole batch ahead of the main query's own values.

      Parameters

      Returns { sql: string; values: unknown[] }

    • Bulk insert records into a table

      Parameters

      • tableName: string
      • records: Record<string, any>[]
      • Optional_options: any

      Returns Promise<QueryResult>

    • Update every row matching where with values in a single statement.

      Parameters

      • tableName: string
      • values: Record<string, unknown>
      • where: WhereOptions = {}

      Returns Promise<unknown>

    • Add a foreign key to a table Note: SQLite does not support ALTER TABLE ADD CONSTRAINT. Foreign keys must be defined when the table is created.

      Parameters

      • tableName: string
      • columnName: string
      • referencedTableName: string
      • referencedColumnName: string
      • Optionaloptions: {
            name?: string;
            onDelete?: "CASCADE" | "RESTRICT" | "SET NULL" | "NO ACTION";
            onUpdate?: "CASCADE" | "RESTRICT" | "SET NULL" | "NO ACTION";
        }

      Returns Promise<void>

    • Run a setter PRAGMA (one that returns no rows).

      On better-sqlite3 this must go through the synchronous exec() API: routing it through query() would call stmt.all() and throw "statement does not return data". Subclasses that don't have a synchronous connection (e.g. TursoDialect over the libSQL wire) override this to run the PRAGMA through their async driver instead.

      Parameters

      • pragma: string

      Returns Promise<void>

    • Rename a column

      Parameters

      • tableName: string
      • oldColumnName: string
      • newColumnName: string

      Returns Promise<void>

    • Create a fulltext index (SQLite supports FTS5)

      Parameters

      • _tableName: string
      • indexName: string
      • fields: string[]
      • Optional_options: { parser?: string; comment?: string }

      Returns Promise<void>

    • Create a spatial index (SQLite supports spatial indexing via RTree)

      Parameters

      • _tableName: string
      • indexName: string
      • fields: string[]
      • Optional_options: { storage?: string; srid?: number }

      Returns Promise<void>

    • Create user mapping (SQLite doesn't support user mappings)

      Parameters

      • _userName: string
      • _serverName: string
      • Optional_options: any

      Returns Promise<void>

    • Drop user mapping (SQLite doesn't support user mappings)

      Parameters

      • _userName: string
      • _serverName: string
      • Optional_options: any

      Returns Promise<void>

    • ST_Distance - calculate distance between two geometries SQLite uses SpatiaLite extension or custom implementation

      Parameters

      • geom1: string
      • geom2: string
      • Optional_srid: number

      Returns string

    • ST_DWithin - check if geometries are within a given distance

      Parameters

      • geom1: string
      • geom2: string
      • distance: number
      • Optional_srid: number

      Returns string

    • ST_Within - check if geometry A is within geometry B

      Parameters

      • geom1: string
      • geom2: string
      • Optional_srid: number

      Returns string

    • ST_Contains - check if geometry A contains geometry B

      Parameters

      • geom1: string
      • geom2: string
      • Optional_srid: number

      Returns string

    • ST_Intersects - check if geometries intersect

      Parameters

      • geom1: string
      • geom2: string
      • Optional_srid: number

      Returns string

    • ST_AsText - convert geometry to text representation

      Parameters

      • geom: string

      Returns string

    • ST_GeomFromText - create geometry from text

      Parameters

      • wkt: string
      • Optionalsrid: number

      Returns string

    • Build an expression to shred a JSON document/array into relational rows. SQLite has no JSON_TABLE function; its real equivalent is the json_each table-valued function, which yields fixed columns (key, value, type, atom, id, parent, fullkey, path). To project those into named/typed columns (matching the other dialects' JSON_TABLE/OPENJSON shape), this wraps json_each in a derived table that applies json_extract per requested column. SQLite: (SELECT json_extract(je.value, '$.path') AS name, ... FROM json_each(expr, '$.rowPath') AS je) AS alias

      Parameters

      • jsonExpression: string
      • rowPath: string
      • columns: { name: string; type?: string; path?: string; forOrdinality?: boolean }[]
      • alias: string

      Returns string