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

Issue #1 resolved
Michael Granger repo owner created an issue

(Via Nikolai Lugovoi in [[|Rubyforge bug 26282]]):

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



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

is technically equivalent to



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