Re: ruby driver postgresql
От | Michael Fuhr |
---|---|
Тема | Re: ruby driver postgresql |
Дата | |
Msg-id | 20060825135136.GA49264@winnie.fuhr.org обсуждение исходный текст |
Ответ на | ruby driver postgresql ("Junkone" <junkone1@gmail.com>) |
Список | pgsql-general |
On Thu, Aug 24, 2006 at 12:11:28PM -0700, Junkone wrote: > I am using the C driver and am trying to run this statement > irb(main):020:0> a=conn.exec("select * from exchanges where id=$1",4) > ArgumentError: wrong number of arguments (2 for 1) > from (irb):20:in `exec' > from (irb):20 > from :0 > irb(main):021:0> > > I get the error. But the ruby doc stats that i can use this parameteric > query. any pointers will be useful. Are you using the ruby-postgres module and looking at the following documentation or a copy of it? http://ruby.scripting.ca/postgres/rdoc/ Specifically, is this what you're seeing? conn.exec(sql, *bind_values) Sends SQL query request specified by sql to the PostgreSQL. Returns a PGresult instance on success. On failure, it raises a PGError exception. bind_values represents values for the PostgreSQL bind parameters found in the sql. PostgreSQL bind parameters are presented as $1, $1, $2, etc. I just looked through the source code for a few versions of that module and only the latest snapshot supports multiple arguments for PGconn#exec. Version 0.7.1 doesn't (that "Release version" is over 3.5 years old!). -- Michael Fuhr
В списке pgsql-general по дате отправления: