INNER CODE UNIT · JavaScript
values
currycan/HaTickets · desktop/src/sql/index.js:91
const values = keys.map(k => {
const v = params[k];
return typeof v === "object" ? JSON.stringify(v) : v;
});
return await db.execute(
`INSERT INTO ${tableName} (${keys.join(", ")}) VALUES (${placeholders})`,
values
);
};
// !!!默认更新所有 - parameterized queries
export const update = async (tableName, params) => {
if (!isAllowedTable(tableName)) {
throw new Error(`Table "${tableName}" is not allowed`);
}
const keys = Object.keys(params);