> I'm using ActiveRecord's connection to execute a custom query (which
> runs fine in psql) like this:
>
>>> result = ActiveRecord::Base.connection.execute("COPY (select *
>>> from users) TO STDOUT WITH CSV;")
> SQL (0.8ms) COPY (select * from users) TO STDOUT WITH CSV;
> => #<PGresult:0x2589ad8>
>>> result.nfields
> => 39
>>> result.ntuples
> => 0
>
> An instance of PGresult is returned. How can I get data out of it?
Load up the rdocs for the postgres gem... it will tell you.... but why
do it this way? Why not use AR to get your records and fastercsv to
convert it to CSV? Much more portable...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---