X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FODBC.pm;h=1e8851b20bcd715c4a7608f9483469663f7648dc;hb=3334d204fcbbddedd73a7f63a285bdda9cb3e031;hp=d9852e7c692a3f180f3fb1ba219d3fc1959e804e;hpb=11f7049f71cd5d6b891e8addd3c0d9cd2a27c3e8;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/ODBC.pm b/lib/DBIx/Class/Storage/DBI/ODBC.pm index d9852e7..1e8851b 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC.pm @@ -4,31 +4,12 @@ use warnings; use base qw/DBIx::Class::Storage::DBI/; use mro 'c3'; -sub _rebless { - my ($self) = @_; +use DBIx::Class::_Util 'modver_gt_or_eq'; +use namespace::clean; - if (my $dbtype = $self->_dbh_get_info('SQL_DBMS_NAME')) { - # Translate the backend name into a perl identifier - $dbtype =~ s/\W/_/gi; - my $subclass = "DBIx::Class::Storage::DBI::ODBC::${dbtype}"; +sub _rebless { shift->_determine_connector_driver('ODBC') } - return if $self->isa($subclass); - - if ($self->load_optional_class($subclass)) { - bless $self, $subclass; - $self->_rebless; - } - else { - warn "Expected driver '$subclass' not found, using generic support. " . - "Please file an RT.\n"; - } - } - else { - warn "Could not determine your database type, using generic support.\n"; - } -} - -# Whether or not we are connecting via the freetds ODBC driver. +# Whether or not we are connecting via the freetds ODBC driver sub _using_freetds { my $self = shift; @@ -55,11 +36,17 @@ sub _disable_odbc_array_ops { my $self = shift; my $dbh = $self->_get_dbh; - if (eval { DBD::ODBC->VERSION('1.35_01') }) { - $dbh->{odbc_array_operations} = 0; - } - elsif (eval { DBD::ODBC->VERSION('1.33_01') }) { - $dbh->{odbc_disable_array_operations} = 1; + $DBD::ODBC::__DBIC_DISABLE_ARRAY_OPS_VIA__ ||= [ do { + if( modver_gt_or_eq('DBD::ODBC', '1.35_01') ) { + odbc_array_operations => 0; + } + elsif( modver_gt_or_eq('DBD::ODBC', '1.33_01') ) { + odbc_disable_array_operations => 1; + } + }]; + + if (my ($k, $v) = @$DBD::ODBC::__DBIC_DISABLE_ARRAY_OPS_VIA__) { + $dbh->{$k} = $v; } }