ruby pg can't determine data type for parameters
I have simple ruby script.
@connect = PGconn.connect(@host, 5432, '', '', @db, @dbuser, @password)
sql = "SELECT count(brand) as count FROM my_tbl WHERE time >= NOW() -
INTERVAL '$1' HOUR GROUP BY my_tbl.brand HAVING count(brand) > $2 ORDER BY
count DESC"
res = @connect.exec_params(sql,[1,2])
Whenever I run this part of code I'm having error
could not determine data type of parameter $1
What am I missing?
I tried to put strings instead of [1,2] it still didn't work. $1 has
apostrophe but that SHOULD NOT be a problem. If it is (I can't remove
apostrophe) then why?
No comments:
Post a Comment