Commit | Line | Data |
995edf3f |
1 | package DBIx::Class::Schema::Loader::DBI::ODBC; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use base 'DBIx::Class::Schema::Loader::DBI'; |
942bd5e0 |
6 | use mro 'c3'; |
3b17d988 |
7 | use Carp::Clan qw/^DBIx::Class/; |
8 | use namespace::clean; |
995edf3f |
9 | |
4295c4b4 |
10 | our $VERSION = '0.07010'; |
995edf3f |
11 | |
e57fd726 |
12 | =head1 NAME |
13 | |
8793567f |
14 | DBIx::Class::Schema::Loader::DBI::ODBC - L<DBD::ODBC> proxy |
e57fd726 |
15 | |
16 | =head1 DESCRIPTION |
17 | |
8793567f |
18 | Reblesses into an C<::ODBC::> class when connecting via L<DBD::ODBC>. |
e57fd726 |
19 | |
20 | Code stolen from the L<DBIx::Class> ODBC storage. |
21 | |
22 | See L<DBIx::Class::Schema::Loader::Base> for usage information. |
23 | |
24 | =cut |
25 | |
995edf3f |
26 | sub _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 |
45 | sub _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 | |
53 | L<DBIx::Class::Schema::Loader::DBI::ODBC::Microsoft_SQL_Server>, |
71a6e88a |
54 | L<DBIx::Class::Schema::Loader::DBI::ODBC::SQL_Anywhere>, |
55 | L<DBIx::Class::Schema::Loader::DBI::ODBC::Firebird>, |
e57fd726 |
56 | L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>, |
57 | L<DBIx::Class::Schema::Loader::DBI> |
58 | |
59 | =head1 AUTHOR |
60 | |
9cc8e7e1 |
61 | See L<DBIx::Class::Schema::Loader/AUTHOR> and L<DBIx::Class::Schema::Loader/CONTRIBUTORS>. |
be80bba7 |
62 | |
63 | =head1 LICENSE |
64 | |
65 | This library is free software; you can redistribute it and/or modify it under |
66 | the same terms as Perl itself. |
e57fd726 |
67 | |
68 | =cut |
69 | |
995edf3f |
70 | 1; |