From: Rafael Kitover Date: Fri, 3 Jul 2009 00:32:48 +0000 (+0000) Subject: minor changes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=64f4e6918b4284ea08e9b01fe23ee00aaa058b35;p=dbsrgits%2FDBIx-Class-Historic.git minor changes --- diff --git a/lib/DBIx/Class/Storage/DBI/Sybase.pm b/lib/DBIx/Class/Storage/DBI/Sybase.pm index 05cc32a..39062a2 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase.pm @@ -4,8 +4,8 @@ use strict; 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 @@ sub _dbh_last_insert_id { 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 diff --git a/t/746sybase.t b/t/746sybase.t index a8f9815..5554649 100644 --- a/t/746sybase.t +++ b/t/746sybase.t @@ -14,7 +14,7 @@ if (not ($dsn && $user)) { "\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 @@ for my $storage_type (@storage_types) { }); $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 @@ SQL ok(eval { $rs->search({ id=> $id }, { select => [$type] })->single->$type } eq $binstr{$size}, "verified inserted $size $type" ); + diag $@ if $@; } }