[Dbix-class] Fwd: Simple query makes SQL::Abstract puke
Ido Perlmuter
ido at ido50.net
Thu Oct 8 13:01:28 GMT 2009
Yep, that was my stupid mistake. $stage->id was OK, it was $foreign->id that
made the problem... I forgot I missed a many_to_many connection, so
$foreign->id actually returned an array instead of the unique row I really
wanted. Don't know why I didn't think about using Dumper to check the
hash-ref, as I do use it a lot.
Well, never mind, all is well now, thanks a lot everyone.
Ido.
On Thu, Oct 8, 2009 at 2:38 PM, Quinn Fazigu <quinnfazigu at gmail.com> wrote:
>
>
>
>
>
> 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 y=
ou
> 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_i=
d =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'
> };
>
>
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20091008/9a7=
aa5c6/attachment.htm
More information about the DBIx-Class
mailing list