MCPcopy Create free account
hub / github.com/outerbase/studio / findFirst

Function findFirst

src/drivers/common-sql-imp.ts:150–163  ·  view source on GitHub ↗
(
    schemaName: string,
    tableName: string,
    key: Record<string, DatabaseValue>
  )

Source from the content-addressed store, hash-verified

148 }
149
150 async findFirst(
151 schemaName: string,
152 tableName: string,
153 key: Record<string, DatabaseValue>
154 ): Promise<DatabaseResultSet> {
155 const wherePart = Object.entries(key)
156 .map(([colName, colValue]) => {
157 return `${this.escapeId(colName)} = ${escapeSqlValue(colValue)}`;
158 })
159 .join(" AND ");
160
161 const sql = `SELECT * FROM ${this.escapeId(schemaName)}.${this.escapeId(tableName)} ${wherePart ? "WHERE " + wherePart : ""} LIMIT 1 OFFSET 0`;
162 return this.query(sql);
163 }
164
165 async selectTable(
166 schemaName: string,

Callers

nothing calls this directly

Calls 3

escapeSqlValueFunction · 0.90
queryMethod · 0.65
escapeIdMethod · 0.45

Tested by

no test coverage detected