[Catalyst] CDBI::Sweet returning empty iterator from page()

Dylan Vanderhoof DylanV at semaphore.com
Sat Jan 28 23:10:48 CET 2006


Yep, me again with yet another CDBI problem.  

This code WAS working a few days ago, but so many things were changed chasing down another bug (which turned out to be a problem with mysql, not CDBI), that I can't figure out what might have caused this...

The CDBI::Sweet query looks like this:

    my $where    = { customer_id => $c->session->{'customer_id'} };
    my $order_by = "timestamp DESC";

    my ( $page, $entries ) = Application::Model::CDBI::Table->page( $where, { rows => $c->session->{table}->{perpage}, page => $c->session->{table}->{page}, order_by => $order_by } );


No problems so far, and the $page object has all the correct information in it.  However, the $entries object has alot of undef ids.  I checked the mysql query log, and the query is being created and executed as it should be.

Here's a dump of the page and entries objects:

                        'page' => bless( {
                                           'total_entries' => '3855',
                                           'current_page' => '1',
                                           'entries_per_page' => '5'
                                         }, 'Data::Page' ),
                        'entries' => bless( {
                                              '_data' => [
                                                           {
                                                             'id' => undef
                                                           },
                                                           {
                                                             'id' => undef
                                                           },
                                                           {
                                                             'id' => undef
                                                           },
                                                           {
                                                             'id' => undef
                                                           },
                                                           {
                                                             'id' => undef
                                                           }
                                                         ],
                                              '_place' => 0,
                                              '_count' => 5,
                                              '_mapper' => [],
                                              '_class' => 'Application::Model::CDBI::Table'
                                            }, 'Class::DBI::Iterator' )


What might be going on here, or more specifically, how can I debug this?  I have not tried loading it in the perl debugger yet, but that's probably my next step.  Just wanted to see if anybody has seen this behavior before, or if there's something obvious causing this.

Thanks,
Dylan



More information about the Catalyst mailing list