MCPcopy Create free account
hub / github.com/damms005/devdb-vscode / getTotalRows

Function getTotalRows

src/services/sql.ts:54–67  ·  view source on GitHub ↗
(engine: DatabaseEngine, dialect: KnexClientType, connection: knexlib.Knex | null, table: string, columns: Column[], whereClause?: Record<string, any>)

Source from the content-addressed store, hash-verified

52 },
53
54 async getTotalRows(engine: DatabaseEngine, dialect: KnexClientType, connection: knexlib.Knex | null, table: string, columns: Column[], whereClause?: Record<string, any>): Promise<number> {
55 if (!connection) return 0;
56
57 let query = connection(table);
58
59 if (whereClause) {
60 const conditions = buildWhereClause(engine, dialect, whereClause, columns)
61 query = applyConditionToQuery(query, conditions)
62 }
63
64 const result = await query.count('* as count');
65
66 return (result[0])?.count as number;
67 },
68
69 async commitChange(connection: knexlib.Knex | null, serializedMutation: SerializedMutation, transaction?: knexlib.Knex.Transaction, openDelimiter: string = '`'): Promise<void> {
70 if (!connection) return;

Callers

nothing calls this directly

Calls 2

buildWhereClauseFunction · 0.85
applyConditionToQueryFunction · 0.85

Tested by

no test coverage detected