(dialect: RuntimeSchemaDialect, executedSql: string[])
| 12 | } from './runtimeSchemaBootstrap.js'; |
| 13 | |
| 14 | function createStubClient(dialect: RuntimeSchemaDialect, executedSql: string[]): RuntimeSchemaClient { |
| 15 | return { |
| 16 | dialect, |
| 17 | begin: async () => {}, |
| 18 | commit: async () => {}, |
| 19 | rollback: async () => {}, |
| 20 | execute: async (sqlText: string) => { |
| 21 | if (sqlText.trim().toLowerCase().startsWith('select')) { |
| 22 | return []; |
| 23 | } |
| 24 | executedSql.push(sqlText); |
| 25 | return []; |
| 26 | }, |
| 27 | queryScalar: async (sqlText: string, params: unknown[] = []) => { |
| 28 | if (sqlText.includes('information_schema') || sqlText.includes('sqlite_master') || sqlText.includes('pragma_table_info')) { |
| 29 | return 1; |
| 30 | } |
| 31 | if (params.length > 0) { |
| 32 | return 1; |
| 33 | } |
| 34 | return 0; |
| 35 | }, |
| 36 | close: async () => {}, |
| 37 | }; |
| 38 | } |
| 39 | |
| 40 | function makeColumn(overrides: Partial<SchemaContractColumn> = {}): SchemaContractColumn { |
| 41 | return { |
no test coverage detected