[Dbix-class] Fwd: Simple query makes SQL::Abstract puke

Quinn Fazigu quinnfazigu at gmail.com
Thu Oct 8 12:38:16 GMT 2009


On Thu, Oct 8, 2009 at 8:18 AM, Ido Perlmuter <ido at ido50.net> wrote:

> For some reason, the following query has been constantly causing an
> SQL::Abstract error message.
>
> Query: $c->model('DB::Stuff')->single({ stage_id =3D> $stage->id, num =3D=
> 0,
> foreign_id =3D> $foreign->id, type =3D> 0 });
>
> Error: "can't quote an empty label".
>

Just a wild guess:

Are $stage->id() or $foreign->id() returning an array and/or undef, perhaps,
and that's causing a hashref key that is an "empty" label?  Do you see the
"Odd number of elements" or "uninitialized value" errors?

$ perl -Mwarnings -Mstrict -MData::Dumper -e 'my $stage =3D sub { return qw=
( a
b ) }; my $foreign =3D sub { return undef }; my $query_hr =3D { stage_id =
=3D>
$stage->(), num =3D> 0, foreign_id =3D> $foreign->(), type =3D> 0 }; print
Dumper($query_hr);'
Use of uninitialized value in anonymous hash ({}) at -e line 1.
Odd number of elements in anonymous hash at -e line 1.
$VAR1 =3D {
          '' =3D> 'type',
          '0' =3D> undef,
          'b' =3D> 'num',
          'stage_id' =3D> 'a'
        };
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20091008/43c=
c7dd3/attachment.htm


More information about the DBIx-Class mailing list