On Sun, Jul 15, 2001 at 09:15:02PM +0100, Tim Bunce wrote:
> On Sat, Jul 14, 2001 at 05:00:11PM -0700, Alex Algard wrote:
> > > It was a mistake. I've deleted it now. Use...
> > > $ary_ref = $sth->fetchall_arrayref( {} );
> >
> > That's actually what I'm doing now. My concern is that using
> > fetchall_arrayref() by passing an anonymous hash as an argument is
> > susceptible to typos when the columns are being initialized, and the code
> > also requires more maintenance, for example, if a table column is added or
> > renamed. In addition, using this approach on a table with many columns would
> > result in a lot of code. So please consider adding fetchall_hashref() to
> > DBI.
>
> Pass a ref to an empty hash. See the docs, and the code.
>
I'm curious why this interface was chosen-- a function named
'fetchall_arrayref' will actually return a hash ref instead if the first
argument happens to be a hash ref -- instead of just having a function
called 'fetchall_hashref'. This behavior seems counter-intuitive and
likely to cause confusion.
Ronald