X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FCDBICompat%2FRetrieve.pm;h=4c368873c973211c85d76552d5d078cd65af0f9f;hb=e60dc79fcd4d6318e83584b826526e65048b86a9;hp=1186ae4583a76066e5c474e55a18af4356ea15d0;hpb=05e8dc0a4848cd094c2aa063d183500017421fcc;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/CDBICompat/Retrieve.pm b/lib/DBIx/Class/CDBICompat/Retrieve.pm index 1186ae4..4c36887 100644 --- a/lib/DBIx/Class/CDBICompat/Retrieve.pm +++ b/lib/DBIx/Class/CDBICompat/Retrieve.pm @@ -47,12 +47,35 @@ sub _build_query { sub retrieve_from_sql { my ($class, $cond, @rest) = @_; + $cond =~ s/^\s*WHERE//i; - $class->search_literal($cond, @rest); + + if( $cond =~ s/\bLIMIT (\d+)\s*$//i ) { + push @rest, { rows => $1 }; + } + + return $class->search_literal($cond, @rest); +} + +sub construct { + my $class = shift; + my $obj = $class->resultset_instance->new_result(@_); + $obj->in_storage(1); + + return $obj; } sub retrieve_all { shift->search } sub count_all { shift->count } - # Contributed by Numa. No test for this though. + +sub maximum_value_of { + my($class, $col) = @_; + return $class->resultset_instance->get_column($col)->max; +} + +sub minimum_value_of { + my($class, $col) = @_; + return $class->resultset_instance->get_column($col)->min; +} 1;