Function
executeQuery
(
sql: string,
args: any[] = []
)
Source from the content-addressed store, hash-verified
| 1 | // Función para ejecutar una consulta SQL con parámetros preparados |
| 2 | import { client } from "@/lib/turso" |
| 3 | export async function executeQuery( |
| 4 | sql: string, |
| 5 | args: any[] = [] |
| 6 | ): Promise<any> { |
| 7 | try { |
| 8 | const data = await client.execute({ sql: sql, args: args }) |
| 9 | return data.rows |
| 10 | } catch (error: any) { |
| 11 | throw new Error("Error executing SQL query: " + error.message) |
| 12 | } |
| 13 | } |
Tested by
no test coverage detected