Issue #1 resolved

pg-0.8.0 : counter-intuitive PGconn#exec() {|r| block }

Michael Granger
repo owner created an issue

(Via Nikolai Lugovoi in [[http://rubyforge.org/tracker/index.php?func=detail&aid=26282&group_id=3214&atid=12396|Rubyforge bug 26282]]):

currently, when block is passed to conn.exec, only first result row is yielded, i.e.

{{{

!ruby

conn.exec("...") do |r| some_function(r) end }}}

is technically equivalent to

{{{

!ruby

begin result = conn.exec("...") return some_function(result[0]) ensure result.clear end }}}

attached patch changes it to yield PGresult object and return result of passed block, for {{{conn.exec}}}, {{{conn.exec_prepared}}}, {{{conn.get_result}}}

also updated method docs.

Comments (1)

  1. Log in to comment