Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0005-grc-runners FR-004
The sql runner (0005-grc-runners FR-004): the input is { query, params? } and the value is the rows. It runs the query on a connection the host gives, of the shape { readOnly, query(text, params) }; the drivers of data (and the osquery driver that is coming) satisfy it by shape, and this unit imports no database library. It refuses a connection that is not read-only, and a query that the guard of the SQL language library does not judge to be a single read in the dialect of the connection (more than one statement, a write, a SELECT ... INTO, a PRAGMA that sets).
Source: commons/grc/src/runners/sql/mod.ts
2 of 3 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.
SqlConnectiontypeno test imports ittype SqlConnection = {
readonly readOnly: boolean;
/** The dialect of the connection's queries (ANSI where none is given). */
readonly dialect?: Dialect;
query(text: string, params: readonly Json[]): Promise<readonly Json[]>;
};
What the host gives: a connection that answers queries and says it only reads.
function refusal(query: string, dialect?: Dialect): string | undefined
Why a query is not a single read in the dialect (ANSI where none is given), or undefined where it is one: the tree of the SQL language library is judged, so a word in a string or a comment is not code (a PRAGMA that reads is let through).
Imported by 9 tests of the run (9 passed, 0 failed): the library's results
function sqlRunner(connection: SqlConnection): Runner
The sql runner over a connection.
Imported by 15 tests of the run (15 passed, 0 failed): the library's results