I'm trying to execute raw query in typeorm with parameters I tried following queries:
insert into data(id, name, gender) values(?, ?,?)
insert into data(id, name, gender) values($1, $2, $3)
insert into data(id, name, gender) values(:id, :name, :gender)
The typeorm code is:
import { getManager } from 'typeorm';
await getManager().query(query, [1, 'test', 'male']);
What is wrong? Is there any other way?
Issue solved with this link. It depends on the underlying database which syntax to use.
https://github.com/typeorm/typeorm/issues/881
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With