From: Paul Makepeace Date: Thu, 10 Nov 2005 14:05:55 +0000 (+0000) Subject: Added some examples and explanations for search() X-Git-Tag: v0.05005~178 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=20f67ac70020b74aa6cacc7b339da66a138eddda;p=dbsrgits%2FDBIx-Class.git Added some examples and explanations for search() --- diff --git a/lib/DBIx/Class/Table.pm b/lib/DBIx/Class/Table.pm index 42631de..3ded88c 100644 --- a/lib/DBIx/Class/Table.pm +++ b/lib/DBIx/Class/Table.pm @@ -100,9 +100,19 @@ sub count { =item search - my @obj = $class->search({ foo => 3 }); + my @obj = $class->search({ foo => 3 }); # "... WHERE foo = 3" my $cursor = $class->search({ foo => 3 }); +To retrieve all rows, simply call C with no condition parameter, + + my @all = $class->search(); # equivalent to search({}) + +If you need to pass in additional attributes (see +L for details) an empty hash indicates +no condition, + + my @all = $class->search({}, { cols => [qw/foo bar/] }); # "SELECT foo, bar FROM $class_table" + =cut sub search {