[Dbix-class] ResultClass::HashRefInflator skipping last column on table joins

Jillian Rowe jir2004 at qatar-med.cornell.edu
Mon Nov 26 07:15:33 GMT 2012


Hello all,

I am having trouble using DBIx::ResultClass::HashRefInflator on a result set that has table joins.

$c->stash(rs => $c->model(DB::TABLE1))
$rs = $c->stash->{rs};

$rs = $rs->search(
   undef,
    {   
        select => [COL1, TABLE2.COL2, TABLE2.COL3, TABLE2.COL4],
        join => [TABLE2],
        }   
    );  

The SQL output gives me the correct sql statement, but

$rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
 @infl = $rs->all;


{
            'TABLE2' => {
                        'COL2' => '1',
                        'COL3' => '-1',
                      },
            'COL1' => 'val'
 }

but it should be
{
            'TABLE2' => {
                        'COL2' => 'val',
                        'COL3' => 'val',
                        'COL4' => 'val',
                      },
            'COL1' => 'val'
 },


However, using 

$cursor = $rs->cursor;
while (my @vals = $cursor->next) {
       $c->log->debug("ROW: @vals");
}

Gives me the correct number of columns.

DBIx::ResultClass::HashRefInflator works great for all my other non table joining endeavors. It would be nice to be able to use it for the joins as well to keep my code uniform.

Any ideas for me?

Best,
Jillian


 


More information about the DBIx-Class mailing list