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 <[email protected]> wrote:

>
>
>
>
>
> On Thu, Oct 8, 2009 at 8:18 AM, Ido Perlmuter <[email protected]> wrote:
>
>> For some reason, the following query has been constantly causing an
>> SQL::Abstract error message.
>>
>> Query: $c->model('DB::Stuff')->single({ stage_id => $stage->id, num => 0,
>> foreign_id => $foreign->id, type => 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 = sub { return qw(
> a b ) }; my $foreign = sub { return undef }; my $query_hr = { stage_id =>
> $stage->(), num => 0, foreign_id => $foreign->(), type => 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 = {
>           '' => 'type',
>           '0' => undef,
>           'b' => 'num',
>           'stage_id' => '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/[email protected]
>
_______________________________________________
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/[email protected]

Reply via email to