[Dbix-class] ResultClass::HashRefInflator skipping last column
on table joins
Jillian Rowe
jir2004 at qatar-med.cornell.edu
Mon Nov 26 10:08:07 GMT 2012
I was cutting and pasting from several logs, sorry about that. Lets start fresh.
SQL statement:
SELECT me.PID, qdem.qdem0006, qdem.qdem0007, qdem.qdem0008, qdem.qdem0009, qdem.qdem0010 FROM qpid me LEFT JOIN qdem qdem ON qdem.qdempid = me.pid
Fields:
'FIELDS' => [
'PID',
'qdem.qdem0006',
'qdem.qdem0007',
'qdem.qdem0008',
'qdem.qdem0009',
'qdem.qdem0010 '
]
The inflator is giving me the same result as before, leaving off qdem0010. No matter what case I choose it leaves off the last. If Fields is
[ 'PID',
'qdem.qdem0006',
'qdem.qdem0007',
'qdem.qdem0008', ]
The inflator leaves off the 0008, but cursor keeps it.
Perhaps there is an error someplace else. I will try to keep on it and see what happens.
________________________________________
From: Peter Rabbitson [rabbit+dbic at rabbit.us]
Sent: Monday, November 26, 2012 12:16 PM
To: DBIx::Class user and developer list
Subject: Re: [Dbix-class] ResultClass::HashRefInflator skipping last column on table joins
On Mon, Nov 26, 2012 at 08:31:31AM +0000, Jillian Rowe wrote:
>
> #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
>
I don't get it... you asked in FIELDS to receive qdem6~qdem9, and this
is what HRI gave you back. I am not even entrirely sure *why* $rs->cursor
returned more fields - *this* looks like a bug. Please show the SQL trace
from the above ->all call (DBIC_TRACE=1 DBIC_TRACE_PROFILE=console)
Cheers
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
More information about the DBIx-Class
mailing list