enalmada
enalmada
DTDrizzle Team
Created by enalmada on 8/24/2023 in #help
parameterized insert and update
How does one do parameterized inserts and updates? When I try and do something like this:
const preparedUpdate = db
.update(TaskTable)
.set({
title: eq(TaskTable.id, sql.placeholder('title')),
})
.where(eq(TaskTable.id, sql.placeholder('id')))
.returning()
.prepare('Task.update');
const preparedUpdate = db
.update(TaskTable)
.set({
title: eq(TaskTable.id, sql.placeholder('title')),
})
.where(eq(TaskTable.id, sql.placeholder('id')))
.returning()
.prepare('Task.update');
I get "expression is of type boolean" for all the columns.
ERR PostgresError: column "title" is of type status but expression is of type boolean
...
ERR PostgresError: column "title" is of type status but expression is of type boolean
...
Is there another syntax necessary for placeholder in set? Thanks for your help.
11 replies