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