做了一些google搜索半天,我无法找到使用PG宝石(红宝石的PostgreSQL GEM)准备的INSERT语句中的任何样品。
我想这(看着宝石文档后):
def test2
conn = PG.connect( dbname: 'db1' )
conn.prepare("statement1", 'INSERT INTO table1 (id, name, profile) VALUES (?, ?, ?)')
end
但我得到以下错误:
pgtest.rb:19:in `prepare': ERROR: syntax error at or near "," (PG::Error)
LINE 1: INSERT INTO table1 (id, name, profile) VALUES (?, ?, ?)
^
from pgtest.rb:19:in `test2'
from pgtest.rb:25:in `<main>'