On 13 Nov 2006, at 19:40, Christopher H. Laco wrote:
Christopher H. Laco wrote:
I have a resultset question. Is this by design, or by accident?
This fails
$schema->resultset('Carts')->search(undef, undef);
with:
Use of uninitialized value in anonymous hash ({}) at C:/
strawberry-perl/perl/site/lib/DBIx/Class/ResultSet.pm line 190.
DBIx::Class::ResultSet::search(): DBD::SQLite::db prepare_cached
failed: near "IS": syntax error(1) at dbdimp.c line 269
at C:/strawberry-perl/perl/site/lib/DBIx/Class/Storage/DBI.pm
line 978.
This succeeds:
$schema->resultset('Carts')->search(undef, {});
They're both equally futile when written manually. But in things like
Handel, where I'm simply passing @_ down the line to DBIC search
sub search {
my $self = shift;
magic...
$schema->resultset('Carts')->search(@_);
}
$handel->search($filter, $options);
It's pita to check @_ for undefs, and strip them out, rather than
having DBIC just ignore them...
Of course, I could be off my rocker...
-=Chris
And of course, more perplexing is that this fails:
$schema->resultset('Carts')->search(undef, []);
with the same error message.
That's because it's interpreted as ->search({ undef => [] });
--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for
details.
+ Help us build a better perl ORM: http://dbix-
class.shadowcatsystems.co.uk/ +
--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for
details.
+ Help us build a better perl ORM: http://dbix-
class.shadowcatsystems.co.uk/ +
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/