.deini
.deini
DTDrizzle Team
Created by .deini on 9/20/2023 in #help
Using a placeholder with an inArray
I'm porting a query to a prepared statement, in the query I used to do something like:
.where(inArray(users.id), ['abc', 'def']))
.where(inArray(users.id), ['abc', 'def']))
After trying to move it to a prepared statement:
.where(inArray(users.id), placeholder("userIds"))
.where(inArray(users.id), placeholder("userIds"))
However, when I execute the pepared statement and pass { userIds: ['abc', 'def'] } I get a syntax error: PostgresError: syntax error at or near "$1"
2 replies
DTDrizzle Team
Created by .deini on 7/4/2023 in #help
sql escaping on where
Trying to do the following:
where: sql`unaccent(${users.fullName}) ILIKE unaccent('%${input.query}%')`,
where: sql`unaccent(${users.fullName}) ILIKE unaccent('%${input.query}%')`,
But it breaks on the secon unaccent with could not determine data type of parameter $1 . What am I missing? 🤔
4 replies