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