A little performance hack to speed up efficiency. Internal checks that the
Michael G Schwern [Fri, 14 Mar 2008 22:50:04 +0000 (22:50 +0000)]
resultset is defined would make a SQL COUNT happen.

lib/DBIx/Class/CDBICompat/Iterator.pm

index 1b96835..3466769 100644 (file)
@@ -3,6 +3,7 @@ package DBIx::Class::CDBICompat::Iterator;
 use strict;
 use warnings;
 
+
 =head1 NAME
 
 DBIx::Class::CDBICompat::Iterator
@@ -41,7 +42,11 @@ use warnings;
 use base qw(DBIx::Class::ResultSet);
 
 sub _bool {
-  return $_[0]->count;
+    # Performance hack so internal checks whether the result set
+    # exists won't do a SQL COUNT.
+    return 1 if caller =~ /^DBIx::Class::/;
+
+    return $_[0]->count;
 }
 
 1;