Vinny
Vinny
DTDrizzle Team
Created by Vinny on 4/8/2024 in #help
Using sql.placeholder with limit in creating a prepared query
I am attempting to create a prepared query like this...
const findByNamePrepared = this.database
.select()
.from(table)
.where(like(table.fullName, sql.placeholder('fullName')))
.limit(sql.placeholder('limit'))
.offset(sql.placeholder('offset'))
.prepare();
const findByNamePrepared = this.database
.select()
.from(table)
.where(like(table.fullName, sql.placeholder('fullName')))
.limit(sql.placeholder('limit'))
.offset(sql.placeholder('offset'))
.prepare();
It fails to compile with the following message:
error TS2345: Argument of type 'Placeholder<"limit", any>' is not assignable to parameter of type 'number'.
35 .limit(sql.placeholder('limit'))
error TS2345: Argument of type 'Placeholder<"offset", any>' is not assignable to parameter of type 'number'.
36 .offset(sql.placeholder('offset'))
error TS2345: Argument of type 'Placeholder<"limit", any>' is not assignable to parameter of type 'number'.
35 .limit(sql.placeholder('limit'))
error TS2345: Argument of type 'Placeholder<"offset", any>' is not assignable to parameter of type 'number'.
36 .offset(sql.placeholder('offset'))
How are placeholders suppose to work with limit and offset?
14 replies