kwatch
9/18/2008 4:31:00 AM
Thank you, Phrogz.
Your advice helps me very much.
I'll adopt fetch_hashes() or fetch_as_hashes().
--
regards,
makoto kuwata
2008/09/18 11:50 am, Phrogz <phr...@mac.com> wrote:
> kwatch wrote:
> > Motto-mysql will add some methods to Mysql::Result class.
>
> > * Mysql::Result#fetch_one_hash() returns a hash.
> > * Mysql::Result#fetch_one_array() returns an array.
> > * Mysql::Result#fetch_one_object(klass) returns an instance of klass
> > * Mysql::Result#fetch_all_hash() returns an array of hashes
> > * Mysql::Result#fetch_all_array() returns an array of arrays
> > * Mysql::Result#fetch_all_object(klass) returns an array of instances
>
> In English, the all* methods should pluralize their nouns...
> fetch_all_hashes
> fetch_all_arrays
> fetch_all_objects
> ...or perhaps...
> fetch_every_hash
> fetch_every_array
> fetch_every_object
>
> I'm not sure I understand what these methods, do, though. If they
> select only items of the described class, I would probably go with:
> fetch_hashes
> fetch_arrays
> fetch_objects
>
> However, if they take an existing results set and interpret the
> entries as the described class, I would probably suggest instead:
> fetch_as_hashes
> fetch_as_arrays
> fetch_as_objects
>
> I hope that helps.