MCPcopy
hub / github.com/antonycourtney/tad / evalQuery

Method evalQuery

packages/reltab/src/DataSource.ts:136–162  ·  view source on GitHub ↗
(
    query: QueryExp,
    offset?: number,
    limit?: number,
    options?: EvalQueryOptions
  )

Source from the content-addressed store, hash-verified

134 }
135
136 async evalQuery(
137 query: QueryExp,
138 offset?: number,
139 limit?: number,
140 options?: EvalQueryOptions
141 ): Promise<TableRep> {
142 const sqlQuery = await this.getSqlForQuery(query, offset, limit);
143 const schema = query.getSchema(this.db.dialect, this.tableMap);
144 const trueOptions = options ? options : defaultEvalQueryOptions;
145
146 if (trueOptions.showQueries) {
147 // log.info("time to generate sql: %ds %dms", t1s, t1ns / 1e6);
148 log.info("evalQuery: evaluating:\n" + sqlQuery);
149 }
150
151 const rows = await this.db.runSqlQuery(sqlQuery);
152 const ret = new TableRep(schema, rows);
153
154 /*
155 if (this.showQueries) {
156 log.info("time to run query: %ds %dms", t3s, t3ns / 1e6);
157 log.info("time to mk table rep: %ds %dms", t4s, t4ns / 1e6);
158 }
159 */
160
161 return ret;
162 }
163
164 async rowCount(query: QueryExp, options?: EvalQueryOptions): Promise<number> {
165 await this.ensureLeafDeps(query);

Callers

nothing calls this directly

Calls 3

getSqlForQueryMethod · 0.95
runSqlQueryMethod · 0.65
getSchemaMethod · 0.45

Tested by

no test coverage detected