pg
gem vil have dig til at bruge nummererede pladsholdere ($1
, $2
, ...) i stedet for positionelle pladsholdere (?
):
conn = PG.connect(:dbname => 'db1')
conn.prepare('statement1', 'insert into table1 (id, name, profile) values ($1, $2, $3)')
conn.exec_prepared('statement1', [ 11, 'J.R. "Bob" Dobbs', 'Too much is always better than not enough.' ])
Den fine manual har dette at sige:
Og igen for exec_prepared
: