Bumping version to 0.07048_01
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBI / ODBC.pm
1 package DBIx::Class::Schema::Loader::DBI::ODBC;
2
3 use strict;
4 use warnings;
5 use base 'DBIx::Class::Schema::Loader::DBI';
6 use mro 'c3';
7
8 our $VERSION = '0.07048_01';
9
10 =head1 NAME
11
12 DBIx::Class::Schema::Loader::DBI::ODBC - L<DBD::ODBC> proxy
13
14 =head1 DESCRIPTION
15
16 Reblesses into an C<::ODBC::> class when connecting via L<DBD::ODBC>.
17
18 Code stolen from the L<DBIx::Class> ODBC storage.
19
20 See L<DBIx::Class::Schema::Loader::Base> for usage information.
21
22 =cut
23
24 sub _rebless {
25     my $self = shift;
26
27     return if ref $self ne __PACKAGE__;
28
29     # stolen from DBIC ODBC storage
30     my $dbh  = $self->schema->storage->dbh;
31     my $dbtype = eval { $dbh->get_info(17) };
32     unless ( $@ ) {
33         # Translate the backend name into a perl identifier
34         $dbtype =~ s/\W/_/gi;
35         my $class = "DBIx::Class::Schema::Loader::DBI::ODBC::${dbtype}";
36         if ($self->load_optional_class($class) && !$self->isa($class)) {
37             bless $self, $class;
38             $self->_rebless;
39         }
40     }
41 }
42
43 =head1 SEE ALSO
44
45 L<DBIx::Class::Schema::Loader::DBI::ODBC::Microsoft_SQL_Server>,
46 L<DBIx::Class::Schema::Loader::DBI::ODBC::SQL_Anywhere>,
47 L<DBIx::Class::Schema::Loader::DBI::ODBC::Firebird>,
48 L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,
49 L<DBIx::Class::Schema::Loader::DBI>
50
51 =head1 AUTHORS
52
53 See L<DBIx::Class::Schema::Loader/AUTHORS>.
54
55 =head1 LICENSE
56
57 This library is free software; you can redistribute it and/or modify it under
58 the same terms as Perl itself.
59
60 =cut
61
62 1;