MCPcopy
hub / github.com/prisma/prisma / executeQueryRaw

Function executeQueryRaw

packages/adapter-ppg/src/ppg.ts:217–238  ·  view source on GitHub ↗

* Executes a raw SQL query and returns the result set.

(executor: Statements, params: SqlQuery)

Source from the content-addressed store, hash-verified

215 * Executes a raw SQL query and returns the result set.
216 */
217async function executeQueryRaw(executor: Statements, params: SqlQuery): Promise<SqlResultSet> {
218 const { sql, args } = params
219
220 try {
221 const convertedArgs = convertArgs(args, params.argTypes)
222 const result = await executor.query(sql, ...convertedArgs)
223
224 // Collect all rows - the driver adapter interface requires synchronous access
225 const rows = await result.rows.collect()
226 // Map columns with type information
227 const columnNames = result.columns.map((col) => col.name)
228 const columnTypes = result.columns.map((col) => fieldToColumnType(col.oid))
229
230 return {
231 columnNames,
232 columnTypes,
233 rows: rows.map((row) => row.values),
234 }
235 } catch (error) {
236 throw convertDriverError(error)
237 }
238}
239
240/**
241 * Executes a raw SQL statement and returns the number of affected rows.

Callers 2

queryRawMethod · 0.85
queryRawMethod · 0.85

Calls 4

convertArgsFunction · 0.90
fieldToColumnTypeFunction · 0.90
convertDriverErrorFunction · 0.90
queryMethod · 0.45

Tested by

no test coverage detected