Canvas Toolkit
← Class index

CMemorySqlTableAdapter

Models and views · extends CSqlTableAdapter

An in-memory SQL table adapter useful for demos and tests.

import { CMemorySqlTableAdapter } from "canvas-toolkit-lib";

Declared members

constructor(tables?: Record<string, readonly CSqlRow[]>);
setTable(table: string, rows: readonly CSqlRow[], autoIncrementColumn?: string | null): void;

Creates or replaces a table with independent copies of the rows.

rows(table: string): CSqlRow[];

Returns independent copies of all records in a table.

setAutoIncrementColumn(table: string, column: string | null): void;
select(request: CSqlSelectRequest): Promise<CSqlSelectResult>;
insert(table: string, values: Readonly<CSqlRow>): Promise<CSqlRow>;
update(table: string, primaryKeyColumn: string, primaryKey: unknown, values: Readonly<CSqlRow>): Promise<void>;
remove(table: string, primaryKeyColumn: string, primaryKey: unknown): Promise<void>;