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=b1dbf7164ee06fa23aef5a799dd57df0357514ba;hp=3462de1ddb202247f3aa0bc5a32aa2b09d026621;hpb=735f190ce9798b79ae0608b62087cdd1d3c0b47e;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/ODBC.pm b/lib/DBIx/Class/Storage/DBI/ODBC.pm index 3462de1..1e8851b 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC.pm @@ -4,6 +4,9 @@ use warnings; use base qw/DBIx::Class::Storage::DBI/; use mro 'c3'; +use DBIx::Class::_Util 'modver_gt_or_eq'; +use namespace::clean; + sub _rebless { shift->_determine_connector_driver('ODBC') } # Whether or not we are connecting via the freetds ODBC driver @@ -33,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; } }