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

Function buildInsertQuery

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

Source from the content-addressed store, hash-verified

80}
81
82export 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
93export function buildUpdateQuery(table: string, data: Record<string, unknown>, where: string) {
94 validateWhereClause(where)

Callers 1

route.tsFile · 0.90

Calls 2

joinMethod · 0.80
sanitizeIdentifierFunction · 0.70

Tested by

no test coverage detected