MCPcopy Index your code
hub / github.com/simstudioai/sim / executeQuery

Function executeQuery

apps/sim/app/api/tools/postgresql/utils.ts:37–48  ·  view source on GitHub ↗
(
  sql: any,
  query: string,
  params: unknown[] = []
)

Source from the content-addressed store, hash-verified

35}
36
37export async function executeQuery(
38 sql: any,
39 query: string,
40 params: unknown[] = []
41): Promise<{ rows: unknown[]; rowCount: number }> {
42 const result = await sql.unsafe(query, params)
43 const rowCount = result.count ?? result.length ?? 0
44 return {
45 rows: Array.isArray(result) ? result : [result],
46 rowCount,
47 }
48}
49
50export function validateQuery(query: string): { isValid: boolean; error?: string } {
51 const trimmedQuery = query.trim().toLowerCase()

Callers 2

route.tsFile · 0.90
route.tsFile · 0.90

Calls 1

unsafeMethod · 0.65

Tested by

no test coverage detected