(table: string, data: Record<string, unknown>)
| 80 | } |
| 81 | |
| 82 | export function buildInsertQuery(table: string, data: Record<string, unknown>) { |
| 83 | const sanitizedTable = sanitizeIdentifier(table) |
| 84 | const columns = Object.keys(data) |
| 85 | const values = Object.values(data) |
| 86 | const placeholders = columns.map(() => '?').join(', ') |
| 87 | |
| 88 | const query = `INSERT INTO ${sanitizedTable} (${columns.map(sanitizeIdentifier).join(', ')}) VALUES (${placeholders})` |
| 89 | |
| 90 | return { query, values } |
| 91 | } |
| 92 | |
| 93 | export function buildUpdateQuery(table: string, data: Record<string, unknown>, where: string) { |
| 94 | validateWhereClause(where) |
no test coverage detected