From: Rafael Kitover Date: Sat, 23 May 2009 20:28:42 +0000 (+0000) Subject: revert last Sybase changes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d29565e0c545871399b0732e7781ea445e7d5b8c;p=dbsrgits%2FDBIx-Class-Historic.git revert last Sybase changes --- diff --git a/Makefile.PL b/Makefile.PL index 7d8175f..8b730ca 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -87,7 +87,6 @@ my %force_requires_if_author = ( 'Hash::Merge', => 0.11, # t/96_is_deteministic_value.t - # t/746sybase.t 'DateTime::Format::Strptime' => 0, ); diff --git a/lib/DBIx/Class/Storage/DBI/Sybase.pm b/lib/DBIx/Class/Storage/DBI/Sybase.pm index 28b4059..0c18d6b 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase.pm @@ -3,51 +3,27 @@ package DBIx::Class::Storage::DBI::Sybase; use strict; use warnings; -use base qw/DBIx::Class::Storage::DBI/; +use base qw/DBIx::Class::Storage::DBI::NoBindVars/; sub _rebless { - my $self = shift; - - if (ref($self) eq 'DBIx::Class::Storage::DBI::Sybase') { - my $dbtype = eval { - @{$self->dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2] - } || ''; - - my $exception = $@; - $dbtype =~ s/\W/_/gi; - my $subclass = "DBIx::Class::Storage::DBI::Sybase::${dbtype}"; - - if (!$exception && $dbtype && $self->load_optional_class($subclass)) { - bless $self, $subclass; - $self->_rebless; - } else { # probably real Sybase - if (not $self->dbh->{syb_dynamic_supported}) { - bless $self, 'DBIx::Class::Storage:DBI::Sybase::NoBindVars'; - $self->_rebless; - } - - $self->dbh->syb_date_fmt('ISO_strict'); - $self->dbh->do('set dateformat mdy'); + my $self = shift; + + my $dbtype = eval { @{$self->dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2] }; + unless ( $@ ) { + $dbtype =~ s/\W/_/gi; + my $subclass = "DBIx::Class::Storage::DBI::Sybase::${dbtype}"; + if ($self->load_optional_class($subclass) && !$self->isa($subclass)) { + bless $self, $subclass; + $self->_rebless; + } } - } } sub _dbh_last_insert_id { - my ($self, $dbh, $source, $col) = @_; - - if (not $self->dbh->{syb_dynamic_supported}) { - # @@identity works only if not using placeholders - # Should this query be cached? - return ($dbh->selectrow_array('select @@identity'))[0]; - } - - # sorry, there's no other way! - my $sth = $dbh->prepare_cached("select max($col) from ".$source->from); - return ($dbh->selectrow_array($sth))[0]; + my $self = shift; + ($self->_dbh->selectrow_array('select @@identity'))[0]; } -sub datetime_parser_type { "DBIx::Class::Storage::DBI::Sybase::DateTime" } - 1; =head1 NAME @@ -62,41 +38,21 @@ L. =head1 CAVEATS -If your version of Sybase does not support placeholders, then this storage -driver uses L as a base, - -In which case, bind variables will be interpolated (properly quoted of course) +This storage driver uses L as a base. +This means that bind variables will be interpolated (properly quoted of course) into the SQL query itself, without using bind placeholders. More importantly this means that caching of prepared statements is explicitly disabled, as the interpolation renders it useless. -If your version of Sybase B support placeholders (check -C<<$dbh->{syb_dynamic_supported}>> then unfortunately there's no way to get the -C without doing a C