Added PGresult#values to return an array of arrays

Issue #61 resolved
yanowitz created an issue

I just pushed https://bitbucket.org/yanowitz/ruby-pg/changeset/59679aee98ee which adds PGresult#values method. I wrote this to speed up ActiveRecord, which internally converts the Hash ruby-pg returns into an array (there are other optimizations to ActiveRecord that I'll be submitting to Rails independently, but this one may be generally useful for folks).

This is how the old postgres ruby gem used to work (PGresult.to_a would give you an array of arrays).

After discussing with Michael Granger, I've arrived at this approach.

Cheers,
Jason

Comments (2)

  1. Michael Granger repo owner

    Thanks for the patch! I moved it down with the other non-libpq functions, redid the spacing a bit, and removed the pointless fflush()es you pointed out, too.

  2. Log in to comment