[Bast-commits] r6106 - in DBIx-Class/0.08/branches/count_distinct: lib/DBIx/Class/Storage/DBI t

arcanez at dev.catalyst.perl.org arcanez at dev.catalyst.perl.org
Sat May 2 01:33:47 GMT 2009


Author: arcanez
Date: 2009-05-02 01:33:47 +0000 (Sat, 02 May 2009)
New Revision: 6106

Removed:
   DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI/MultiDistinctEmulation.pm
Modified:
   DBIx-Class/0.08/branches/count_distinct/t/03podcoverage.t
   DBIx-Class/0.08/branches/count_distinct/t/73oracle.t
Log:
remove DBIx::Class::Storage::DBI::MultiDistinctEmulation

Deleted: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI/MultiDistinctEmulation.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI/MultiDistinctEmulation.pm	2009-05-02 01:20:04 UTC (rev 6105)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI/MultiDistinctEmulation.pm	2009-05-02 01:33:47 UTC (rev 6106)
@@ -1,51 +0,0 @@
-package DBIx::Class::Storage::DBI::MultiDistinctEmulation;
-
-use strict;
-use warnings;
-
-use base qw/DBIx::Class::Storage::DBI/;
-
-sub _select {
-  my ($self, $ident, $select, $condition, $attrs) = @_;
-
-  # hack to make count distincts with multiple columns work in SQLite and Oracle
-  if (ref $select eq 'ARRAY') { 
-      @{$select} = map {$self->replace_distincts($_)} @{$select};
-  } else { 
-      $select = $self->replace_distincts($select);
-  }
-
-  return $self->next::method($ident, $select, $condition, $attrs);
-}
-
-sub replace_distincts {
-    my ($self, $select) = @_;
-
-    $select->{count}->{distinct} = join("||", @{$select->{count}->{distinct}}) 
-	if (ref $select eq 'HASH' && $select->{count} && ref $select->{count} eq 'HASH' && 
-	    $select->{count}->{distinct} && ref $select->{count}->{distinct} eq 'ARRAY');
-
-    return $select;
-}
-
-1;
-
-=head1 NAME 
-
-DBIx::Class::Storage::DBI::MultiDistinctEmulation - Some databases can't handle count distincts with multiple cols. They should use base on this.
-
-=head1 SYNOPSIS
-
-=head1 DESCRIPTION
-
-This class allows count distincts with multiple columns for retarded databases (Oracle and SQLite)
-
-=head1 AUTHORS
-
-Luke Saunders <luke.saunders at gmail.com>
-
-=head1 LICENSE
-
-You may distribute this code under the same terms as Perl itself.
-
-=cut

Modified: DBIx-Class/0.08/branches/count_distinct/t/03podcoverage.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/03podcoverage.t	2009-05-02 01:20:04 UTC (rev 6105)
+++ DBIx-Class/0.08/branches/count_distinct/t/03podcoverage.t	2009-05-02 01:33:47 UTC (rev 6106)
@@ -99,7 +99,6 @@
     'DBIx::Class::Storage::DBI'                         => { skip => 1 },
     'DBIx::Class::Storage::DBI::DB2'                    => { skip => 1 },
     'DBIx::Class::Storage::DBI::MSSQL'                  => { skip => 1 },
-    'DBIx::Class::Storage::DBI::MultiDistinctEmulation' => { skip => 1 },
     'DBIx::Class::Storage::DBI::ODBC400'                => { skip => 1 },
     'DBIx::Class::Storage::DBI::ODBC::DB2_400_SQL'      => { skip => 1 },
     'DBIx::Class::Storage::DBI::Oracle'                 => { skip => 1 },

Modified: DBIx-Class/0.08/branches/count_distinct/t/73oracle.t
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/t/73oracle.t	2009-05-02 01:20:04 UTC (rev 6105)
+++ DBIx-Class/0.08/branches/count_distinct/t/73oracle.t	2009-05-02 01:33:47 UTC (rev 6106)
@@ -39,7 +39,7 @@
   ' as well as following sequences: \'pkid1_seq\', \'pkid2_seq\' and \'nonpkid_seq\''
   unless ($dsn && $user && $pass);
 
-plan tests => 24;
+plan tests => 26;
 
 DBICTest::Schema->load_classes('ArtistFQN');
 my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
@@ -114,7 +114,7 @@
     distinct => 1,
   }
 );
-is($tcount->count, 13, 'multiple column COUNT DISTINCT ok');
+is($tcount->count, 2, 'multiple column COUNT DISTINCT ok');
 
 $tcount = $schema->resultset('Track')->search(
   {},
@@ -123,7 +123,7 @@
     distinct => 1,
   }
 );
-is($tcount->count, 13, 'multiple column COUNT DISTINCT ok');
+is($tcount->count, 2, 'multiple column COUNT DISTINCT ok');
 
 $tcount = $schema->resultset('Track')->search(
   {},
@@ -131,7 +131,7 @@
      group_by => [ qw/position title/ ]
   }
 );
-is($tcount->count, 13, 'multiple column COUNT DISTINCT using column syntax ok');
+is($tcount->count, 2, 'multiple column COUNT DISTINCT using column syntax ok');
 
 # test LIMIT support
 for (1..6) {




More information about the Bast-commits mailing list