Name
sqlSelectAllHashrefArray — returns a reference to an array of hashes, one for each row retrieved from a SQL statement
Synopsis
my $arr_ref = $slashdb->sqlSelectAllHashrefArray($select); my $arr_ref = $slashdb->sqlSelectAllHashrefArray($select, $from); my $arr_ref = $slashdb->sqlSelectAllHashrefArray($select, $from, $where); my $arr_ref = $slashdb->sqlSelectAllHashrefArray($select, $from, $where, $other);
sqlSelectAllHashrefArray
constructs and executes a SQL
statement, retrieving all rows, storing each of them as a hash reference in an
array. This takes the same arguments as sqlSelect
and
handles errors in the same manner. It trades memory for speed, returning its
results as soon as possible, thereby closing the statement handle quickly.
Example
my $arr_ref = $slashdb->sqlSelectAllHashrefArray('nickname, realemail', 'users', 'uid < 1000'); foreach my $user (@$arr_ref) { print "Nickname: $user->{nickname}, email: $user->{realemail}\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.