Skip Menu |

This queue is for tickets about the Class-DBI-Pager CPAN distribution.

Report information
The Basics
Id: 18746
Status: new
Priority: 0/
Queue: Class-DBI-Pager

People
Owner: Nobody in particular
Requestors: ychuang [...] hyoptics.com.cn
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Class-DBI-Pager can't work with $class->sth_to_objects
use ShopFloor::CDBI::SFC::DeptDBH; use ShopFloor::CDBI::SFC::WorkCenterDBH; use ShopFloor::CDBI::SFC::FlowctrlDBH; my $dbh = SFC::FlowctrlD->db_Main; my $sql = ' select d.wkc_id, w.wkc_code, w.wkc_name from sfc_flowctrl_detail d, sfc_workcenter w where d.flowctrlh_id = 1 and d.wkc_id = w.wkc_id order by w.wkc_code '; my $sth = $dbh->prepare( $sql ); $sth->execute; # my @rows = $sth->fetchrow_array; #---get 3 rows my $pager = SFC::FlowctrlD->pager( 10 , 1 ); # ($items_per_page, $current_page) my @rows = $pager->sth_to_objects( $sth ); print "tot recs = ", $#rows, "\n"; # return value -1 : get no rows foreach my $rec ( @rows ) { print "wkc_id =", $rec->wkc_id, " "; print "wkc =", $rec->wkc_id->wkc_code, " "; print $rec->wkc_id->wkc_name, " \n"; }