Name
sqlSelectAll — returns a reference to an array of arrays, one for each row retrieved from a SQL statement
Synopsis
my $arr_ref = $slashdb->sqlSelectAll($select); my $arr_ref = $slashdb->sqlSelectAll($select, $from); my $arr_ref = $slashdb->sqlSelectAll($select, $from, $where); my $arr_ref = $slashdb->sqlSelectAll($select, $from, $where, $other);
sqlSelectAll
builds and executes a SQL statement,
returning a reference to an array, itself containing an array for each row of
the result set. This trades memory use for speed. Instead of holding a
database connection open to retrieve each row as necessary, it retrieves all of
the results at once. This takes the same arguments and handles errors the same
as sqlSelect
.
Example
my $results = $slashdb->sqlSelectAll('nickname, realemail, karma', 'users', 'uid < 100'); foreach my $user (@$results) { print "Nick: $user->[0], email: $user->[1], karma: $user->[2]\n"; }
Get Running Weblogs with Slash 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.