Re: ruby/postgres - getting assoc array of rows?

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: ruby/postgres - getting assoc array of rows?
Дата
Msg-id 20051120055226.GA31492@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: ruby/postgres - getting assoc array of rows?  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-interfaces
On Sat, Nov 19, 2005 at 10:32:47PM -0700, Michael Fuhr wrote:
> You could also convert the PGresult object into an array of PGrow
> objects with a one-liner, although you wouldn't get automatic bytea
> handling as in the function you posted:
> 
> rows = res.collect

Other possibilities are res.to_a, res.entries, res.result, and
res.rows, which all do the same thing: return an array of PGrow
objects.  The collect, to_a, and entries methods are provided by
the Enumerable mixin; the result and rows methods are aliases for
entries, which is synonymous with to_a.  Using any of these methods
ultimately results in calling PGresult#each, which yields the PGrow
objects.

-- 
Michael Fuhr


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: ruby/postgres - getting assoc array of rows?
Следующее
От: CSN
Дата:
Сообщение: Re: ruby/postgres - getting assoc array of rows?