DBIx::Custom::Result - DBIx::Custom Resultset
my $result = $dbi->query($query); # Fetch while (my @row = $result->fetch) { # Do something } # Fetch hash while (my %row = $result->fetch_hash) { # Do something }
Set and Get statement handle
$result = $result->sth($sth); $sth = $reuslt->sth
Set and Get fetch filter
$result = $result->fetch_filter($sth); $fetch_filter = $result->fech_filter;
Set and Get no filter keys when fetching
$result = $result->no_fetch_filters($no_fetch_filters); $no_fetch_filters = $result->no_fetch_filters;
Fetch a row
$row = $result->fetch; # array reference @row = $result->fecth; # array
The following is fetch sample
while (my $row = $result->fetch) { # do something my $val1 = $row->[0]; my $val2 = $row->[1]; }
Fetch row as hash
$row = $result->fetch_hash; # hash reference %row = $result->fetch_hash; # hash
The following is fetch_hash sample
while (my $row = $result->fetch_hash) { # do something my $val1 = $row->{key1}; my $val2 = $row->{key2}; }
Fetch only first row(Scalar context)
$row = $result->fetch_first; # array reference @row = $result->fetch_first; # array
The following is fetch_first sample
$row = $result->fetch_first;
This method fetch only first row and finish statement handle
Fetch only first row as hash
$row = $result->fetch_hash_first; # hash reference %row = $result->fetch_hash_first; # hash
The following is fetch_hash_first sample
$row = $result->fetch_hash_first;
Fetch rows
$rows = $result->fetch_rows($row_count); # array ref of array ref @rows = $result->fetch_rows($row_count); # array of array ref
The following is fetch_rows sample
while(my $rows = $result->fetch_rows(10)) { # do someting }
Fetch rows as hash
$rows = $result->fetch_hash_rows($row_count); # array ref of hash ref @rows = $result->fetch_hash_rows($row_count); # array of hash ref
The following is fetch_hash_rows sample
while(my $rows = $result->fetch_hash_rows(10)) { # do someting }
Fetch all rows
$rows = $result->fetch_all; # array ref of array ref @rows = $result->fecth_all; # array of array ref
The following is fetch_all sample
my $rows = $result->fetch_all;
Fetch all row as array ref of hash ref (Scalar context)
$rows = $result->fetch_hash_all; # array ref of hash ref @rows = $result->fecth_all_hash; # array of hash ref
The following is fetch_hash_all sample
my $rows = $result->fetch_hash_all;
Get error infomation
$error_messege = $result->error; ($error_message, $error_number, $error_state) = $result->error;
You can get get information. This is same as the following.
$error_message : $result->sth->errstr $error_number : $result->sth->err $error_state : $result->sth->state
Finish statement handle
$result->finish
This is equel to
$result->sth->finish;
DBIx::Custom
Yuki Kimoto, <kimoto.yuki at gmail.com>
<kimoto.yuki at gmail.com>
Github http://github.com/yuki-kimoto
Copyright 2009 Yuki Kimoto, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install DBIx::Custom, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Custom
CPAN shell
perl -MCPAN -e shell install DBIx::Custom
For more information on module installation, please visit the detailed CPAN module installation guide.