X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FSybase.pm;h=c7031a1f11dfb5f25c66e843bc73ec0883e708d6;hb=bf77e171c05a74f4fd6941090707ba08a1d1a5f1;hp=84499ed3832645bb05714de58729f21381d0d94e;hpb=47d9646a1ef3d030d6a5456b0fa3d0a28a853e4a;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI/Sybase.pm b/lib/DBIx/Class/Storage/DBI/Sybase.pm index 84499ed..c7031a1 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase.pm @@ -3,15 +3,23 @@ package DBIx::Class::Storage::DBI::Sybase; use strict; use warnings; -use base qw/DBIx::Class::Storage::DBI::NoBindVars/; +use base qw/ + DBIx::Class::Storage::DBI::Sybase::Base + DBIx::Class::Storage::DBI::NoBindVars +/; +use mro 'c3'; sub _rebless { my $self = shift; - my $dbh = $self->schema->storage->dbh; - my $DBMS_VERSION = @{$dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2]; - if ($DBMS_VERSION =~ /^Microsoft /i) { - my $subclass = 'DBIx::Class::Storage::DBI::Sybase::MSSQL'; + my $dbtype = eval { + @{$self->last_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; @@ -19,6 +27,11 @@ sub _rebless { } } +sub _dbh_last_insert_id { + my ($self, $dbh, $source, $col) = @_; + return ($dbh->selectrow_array('select @@identity'))[0]; +} + 1; =head1 NAME @@ -31,6 +44,15 @@ This subclass supports L for real Sybase databases. If you are using an MSSQL database via L, see L. +=head1 CAVEATS + +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. + =head1 AUTHORS Brandon L Black