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

Function buildUpdateQuery

apps/sim/app/api/tools/mysql/utils.ts:93–104  ·  view source on GitHub ↗
(table: string, data: Record<string, unknown>, where: string)

Source from the content-addressed store, hash-verified

91}
92
93export function buildUpdateQuery(table: string, data: Record<string, unknown>, where: string) {
94 validateWhereClause(where)
95
96 const sanitizedTable = sanitizeIdentifier(table)
97 const columns = Object.keys(data)
98 const values = Object.values(data)
99
100 const setClause = columns.map((col) => `${sanitizeIdentifier(col)} = ?`).join(', ')
101 const query = `UPDATE ${sanitizedTable} SET ${setClause} WHERE ${where}`
102
103 return { query, values }
104}
105
106export function buildDeleteQuery(table: string, where: string) {
107 validateWhereClause(where)

Callers 1

route.tsFile · 0.90

Calls 3

joinMethod · 0.80
validateWhereClauseFunction · 0.70
sanitizeIdentifierFunction · 0.70

Tested by

no test coverage detected