Name
DBI::fetchall_arrayref
Synopsis
$ref_of_array_of_arrays = $statement_handle->fetchall_arrayref;
DBI::fetchall_arrayref
returns all of the
remaining data in the statement handle as a reference to an array.
Each row of the array is a reference to another array that contains
the data in that row. The function returns an undefined value
undef
if there is no data in the statement handle.
If any previous
DBI::fetchrow_
*
functions
were called on this statement handle,
DBI::fetchall_arrayref
returns all of the data
after the last
DBI::fetchrow_
*
call.
Example
use DBI; my $db = DBI->connect('DBI:mSQL:mydata',undef,undef); my $query = "SELECT name, date FROM myothertable"; my $output = $db->prepare($query); $output->execute; my $data = $output->fetchall_arrayref; # $data is not a reference to an array of arrays. The each element of the # `master' array is itself an array that contains a row of data. print "The fourth date in the table is: " . $data->[3][1] . "\n"; # data. # Element 1 of that array is the date.
Get MySQL and mSQL 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.