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

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Fri Jul 3 00:32:49 GMT 2009


Author: caelum
Date: 2009-07-03 00:32:48 +0000 (Fri, 03 Jul 2009)
New Revision: 6956

Modified:
   DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
   DBIx-Class/0.08/branches/sybase/t/746sybase.t
Log:
minor changes

Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-07-02 23:24:57 UTC (rev 6955)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm	2009-07-03 00:32:48 UTC (rev 6956)
@@ -4,8 +4,8 @@
 use warnings;
 use mro 'c3';
 use base qw/
-    DBIx::Class::Storage::DBI::Sybase::Base
     DBIx::Class::Storage::DBI
+    DBIx::Class::Storage::DBI::Sybase::Base
 /;
 use Carp::Clan qw/^DBIx::Class/;
 
@@ -250,69 +250,6 @@
   return ($dbh->selectrow_array($sth))[0];
 }
 
-# previous implementation of limited count for Sybase, does not include
-# count_grouped.
-
-#sub _copy_attributes_for_count {
-#  my ($self, $source, $attrs) = @_;
-#  my %attrs = %$attrs;
-#
-#  # take off any column specs, any pagers, record_filter is cdbi, and no point of ordering a count
-#  delete @attrs{qw/select as rows offset page order_by record_filter/};
-#
-#  return \%attrs;
-#}
-#
-#=head2 count
-#
-#Counts for limited queries are emulated by executing select queries and
-#returning the number of successful executions minus the offset.
-#
-#This is necessary due to the limitations of Sybase.
-#
-#=cut
-#
-#sub count {
-#  my $self = shift;
-#  my ($source, $attrs) = @_;
-#
-#  my $new_attrs = $self->_copy_attributes_for_count($source, $attrs);
-#
-#  if (exists $attrs->{rows}) {
-#    my $offset = $attrs->{offset} || 0;
-#    my $total  = $attrs->{rows} + $offset;
-#
-#    my $first_pk = ($source->primary_columns)[0];
-#
-#    $new_attrs->{select} = $first_pk ? "me.$first_pk" : 1;
-#
-#    my $tmp_rs = $source->resultset_class->new($source, $new_attrs);
-#
-#    $self->dbh->{syb_rowcount} = $total;
-#
-#    my $count = 0;
-#    $count++ while $tmp_rs->cursor->next;
-#
-#    $self->dbh->{syb_rowcount} = 0;
-#
-#    return $count - $offset;
-#  } else {
-#    # overwrite the selector
-#    $new_attrs->{select} = { count => '*' };
-#
-#    my $tmp_rs = $source->resultset_class->new($source, $new_attrs);
-#    my ($count) = $tmp_rs->cursor->next;
-#
-#    # if the offset/rows attributes are still present, we did not use
-#    # a subquery, so we need to make the calculations in software
-#    $count -= $attrs->{offset} if $attrs->{offset};
-#    $count = $attrs->{rows} if $attrs->{rows} and $attrs->{rows} < $count;
-#    $count = 0 if ($count < 0);
-#
-#    return $count;
-#  }
-#}
-
 1;
 
 =head1 DATES

Modified: DBIx-Class/0.08/branches/sybase/t/746sybase.t
===================================================================
--- DBIx-Class/0.08/branches/sybase/t/746sybase.t	2009-07-02 23:24:57 UTC (rev 6955)
+++ DBIx-Class/0.08/branches/sybase/t/746sybase.t	2009-07-03 00:32:48 UTC (rev 6956)
@@ -14,7 +14,7 @@
     "\nWarning: This test drops and creates the tables " .
     "'artist' and 'bindtype_test'";
 } else {
-  plan tests => (26 + 2)*2;
+  plan tests => (27 + 2)*2;
 }
 
 my @storage_types = (
@@ -37,9 +37,12 @@
   });
 
   $schema->storage->ensure_connected;
+  $schema->storage->_dbh->disconnect;
 
   isa_ok( $schema->storage, "DBIx::Class::Storage::$storage_type" );
 
+  lives_ok (sub { $schema->storage->dbh }, 'reconnect works');
+
   $schema->storage->dbh_do (sub {
       my ($storage, $dbh) = @_;
       eval { $dbh->do("DROP TABLE artist") };
@@ -151,6 +154,7 @@
       ok(eval {
         $rs->search({ id=> $id }, { select => [$type] })->single->$type
       } eq $binstr{$size}, "verified inserted $size $type" );
+      diag $@ if $@;
     }
   }
 




More information about the Bast-commits mailing list