Placeholders in inserting: db.insert().values(placeholder('example'))

Hey, how do I add placeholders inside the values of an insert prepare statement? I get an typeerror when I do so.
3 Replies
Myrseth
MyrsethOP2y ago
My current code that results in a typeerror is the following:
const insertRoller = db.insert(rolle).values(placeholder('values')).prepare();
const insertRoller = db.insert(rolle).values(placeholder('values')).prepare();
I have no issue using placeholders in delete, and select statements, only in this case. If this is not supported, how can I implement this in something like Vercel Functions?
Alpap
Alpap13mo ago
same issue here i would love to hear the answer to this issue ok found the answer this worked for me db.insert(users) .values({ email: sql.placeholder('email'), name: sql.placeholder('name'), emailVerified: sql.placeholder('emailVerified'), image: sql.placeholder('image'), active: sql.placeholder('active'), roles: sql.placeholder('roles'), company: sql.placeholder('company') }) .onConflictDoNothing() .prepare('insert_users')
Angelelz
Angelelz13mo ago
I don't know that you're supposed to use placeholders for the whole values object or array
Want results from more Discord servers?
Add your server