What’s new with fetching data? (since the book)
$dbh->selectrow_hashref() and $dbh->selectrow_arrayref()
- new one-call prepare + execute + fetch + finish utility methods
$sth->fetchall_arrayref($slice, $max_rows)
- Now implemented in C ‘within’ the driver for maximum speed
- The $max_rows enables fetching of batches of rows
$dbh->selectall_hashref($statement, $keyfield, ...)
$sth->fetchall_hashref($keyfield, ...)
- Returns a ref to hash with one entry per row
- The $keyfield specifies which column value to use for the key
- Each entry in the hash is a ref to a hash holding column values for the row
$h->{FetchHashKeyName} = ’NAME_lc’
- Define the default attribute used by fetchrow_hashref() for key names
- Makes porting scripts much easier (e.g., MySQL <-> Oracle)