Name

selectall_arrayref

Synopsis

$ary_ref = $dbh->selectall_arrayref($statement);
$ary_ref = $dbh->selectall_arrayref($statement, \%attr);
$ary_ref = $dbh->selectall_arrayref($statement, \%attr,
@bind_values);

This utility method combines prepare, execute , and fetchall_arrayref into a single call. It returns a reference to an array containing a reference to an array for each row of data fetched.

The $statement parameter can be a previously prepared statement handle, in which case the prepare is skipped. This is recommended if the statement is going to be executed many times.

If any method except fetch fails, and RaiseError is not set, selectall_arrayref will return undef. If fetch fails, and RaiseError is not set, then it will return with whatever data it has fetched thus far.

Get Programming the Perl DBI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.