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

Jillian Rowe jir2004 at qatar-med.cornell.edu
Mon Nov 26 08:31:31 GMT 2012


Well, for some background I am creating a reporter page where a user selects the variables they want from different tables. Its being used for clinical survey data, one database per study. I have many tables that all have the same structure, one per survey, and one table that contains all patientIDs. Each survey data table has a foreign key constraint on the patientID, Qpid, table. 

The table names and fields are fed to the controller. I have tested this for many cases, but here is one particular.

#This input is part of the url, but I'll define it here for clarity.
$db = "RH";

$c->stash(rs => $c->model($db."::Qpid"))

#for this particular case, sometimes this has an actual value
    $c->stash(WHERE => undef);

    $c->log->debug(Dumper($c->stash->{FIELDS}));
    $c->log->debug(Dumper($c->stash->{TABLES}));

##Gets me 
$c->stash->{FIELDS}
[debug] $VAR1 = [
          'PID',
          'qdem.qdem0006',
          'qdem.qdem0007',
          'qdem.qdem0008',
          'qdem.qdem0009',
        ];
$c->stash->{TABLES}
[debug] $VAR1 = 'qdem';
###


    $rs = $rs->search(
        $c->stash->{WHERE},
        {   
            select => $c->stash->{FIELDS},
            join => $c->stash->{TABLES},
        }   
    );  

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

$c->log->debug(Dumper(\@infl));

###In the debug log
{
            'qdem' => {
                       'qdem0006' => '1',
                       'qdem0007' => '1950',
                       'qdem0009' => '5',
                       'qdem0008' => '-1',
                      },
            'PID' => '0017'
 }
###

While using 

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

###Debug log
0017 1 1950 -1 1 9.5*

**Where 9.5 is from column qdem0010 and missing in the hashrefinflator

My Dbix class version is 0.08196 according to this command 'perl -MDBIx::Class -e 'print $DBIx::Class::VERSION';'

Best,
Jillian


More information about the DBIx-Class mailing list