From: Justin Guenther <jguenther@cpan.org>
Date: Mon, 28 Aug 2006 08:37:53 +0000 (+0000)
Subject: fixed a bug in ResultSet where passing an empty $cond hash to search() and search_rs... 
X-Git-Tag: v0.07002~16
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=760823042a2ce10d6976adf42b9170be1d563f2e;p=dbsrgits%2FDBIx-Class.git

fixed a bug in ResultSet where passing an empty $cond hash to search() and search_rs() would result in an unnecessary empty condition in $self->{cond}
---

diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm
index a508ce9..88c3a0e 100644
--- a/lib/DBIx/Class/ResultSet.pm
+++ b/lib/DBIx/Class/ResultSet.pm
@@ -184,7 +184,15 @@ sub search_rs {
   my $cond = (@_
     ? (
         (@_ == 1 || ref $_[0] eq "HASH")
-          ? shift
+          ? (
+              (ref $_[0] eq 'HASH')
+                ? (
+                    (keys %{ $_[0] }  > 0)
+                      ? shift
+                      : undef
+                   )
+                :  shift
+             )
           : (
               (@_ % 2)
                 ? $self->throw_exception("Odd number of arguments to search")
@@ -205,6 +213,7 @@ sub search_rs {
           }
         : $where);
   }
+
   if (defined $cond) {
     $new_attrs->{where} = (
       defined $new_attrs->{where}