@earth-app/collegedb
    Preparing search index...

    Interface SQLDatabase

    Provider-agnostic SQL database contract.

    interface SQLDatabase {
        dialect?: SQLDialect;
        prepare(sql: string): PreparedStatement;
        runBatch?<T = Record<string, unknown>>(
            statements: BatchStatement[],
        ): Promise<QueryResult<T>[]>;
    }

    Hierarchy (View Summary)

    Implemented by

    Index
    dialect?: SQLDialect

    Which SQL dialect this shard speaks, so generated statements quote identifiers correctly.

    Optional. The adapter factories set it; a raw binding passed straight to initialize leaves it unset, which is read as ANSI double quoting and is correct for D1 and SQLite.

    1.4.0

    • Executes several statements against this shard in one round trip.

      Optional. The provider adapters implement it over D1's native batch, Drizzle's db.batch, or a single driver transaction. CollegeDB falls back to sequential prepare().run() calls when a provider does not implement it, so callers never need to check for it.

      Named runBatch rather than batch on purpose: a raw D1Database is structurally assignable to this contract, and D1 already has a batch that takes prepared statements rather than SQL text. Reusing the name would make env.DB stop satisfying SQLDatabase.

      Statements execute in order and share one transaction per shard. There is no cross-shard atomicity: a routed batch spanning three shards is three independent transactions.

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      Returns Promise<QueryResult<T>[]>

      1.4.0