1 package DBIx::Class::Storage::DBI::ODBC;
4 use base qw/DBIx::Class::Storage::DBI/;
10 if (my $dbtype = $self->_dbh_get_info('SQL_DBMS_NAME')) {
11 # Translate the backend name into a perl identifier
13 my $subclass = "DBIx::Class::Storage::DBI::ODBC::${dbtype}";
15 return if $self->isa($subclass);
17 if ($self->load_optional_class($subclass)) {
18 bless $self, $subclass;
22 warn "Expected driver '$subclass' not found, using generic support. " .
23 "Please file an RT.\n";
27 warn "Could not determine your database type, using generic support.\n";
31 # Whether or not we are connecting via the freetds ODBC driver.
35 my $dsn = $self->_dbi_connect_info->[0];
38 ( (! ref $dsn) and $dsn =~ /driver=FreeTDS/i)
40 ( ($self->_dbh_get_info('SQL_DRIVER_NAME')||'') =~ /tdsodbc/i )
46 # Either returns the FreeTDS version via which we are connecting, 0 if can't
47 # be determined, or undef otherwise
48 sub _using_freetds_version {
50 return undef unless $self->_using_freetds;
51 return $self->_dbh_get_info('SQL_DRIVER_VER') || 0;
54 sub _disable_odbc_array_ops {
56 my $dbh = $self->_get_dbh;
58 if (eval { DBD::ODBC->VERSION('1.35_01') }) {
59 $dbh->{odbc_array_operations} = 0;
61 elsif (eval { DBD::ODBC->VERSION('1.33_01') }) {
62 $dbh->{odbc_disable_array_operations} = 1;
70 DBIx::Class::Storage::DBI::ODBC - Base class for ODBC drivers
74 This class simply provides a mechanism for discovering and loading a sub-class
75 for a specific ODBC backend. It should be transparent to the user.
79 See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
83 You may distribute this code under the same terms as Perl itself.