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'; |
995edf3f |
7 | |
4591a4ff |
8 | our $VERSION = '0.07036_01'; |
995edf3f |
9 | |
e57fd726 |
10 | =head1 NAME |
11 | |
8793567f |
12 | DBIx::Class::Schema::Loader::DBI::ODBC - L<DBD::ODBC> proxy |
e57fd726 |
13 | |
14 | =head1 DESCRIPTION |
15 | |
8793567f |
16 | Reblesses into an C<::ODBC::> class when connecting via L<DBD::ODBC>. |
e57fd726 |
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 | |
995edf3f |
24 | sub _rebless { |
25 | my $self = shift; |
8793567f |
26 | |
27 | return if ref $self ne __PACKAGE__; |
995edf3f |
28 | |
e57fd726 |
29 | # stolen from DBIC ODBC storage |
8793567f |
30 | my $dbh = $self->schema->storage->dbh; |
995edf3f |
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}"; |
b5e1caf2 |
36 | if ($self->load_optional_class($class) && !$self->isa($class)) { |
37 | bless $self, $class; |
38 | $self->_rebless; |
39 | } |
995edf3f |
40 | } |
41 | } |
42 | |
3b17d988 |
43 | sub _tables_list { |
bfb43060 |
44 | my ($self, $opts) = @_; |
8793567f |
45 | |
bfb43060 |
46 | return $self->next::method($opts, undef, undef); |
8793567f |
47 | } |
48 | |
e57fd726 |
49 | =head1 SEE ALSO |
50 | |
51 | L<DBIx::Class::Schema::Loader::DBI::ODBC::Microsoft_SQL_Server>, |
71a6e88a |
52 | L<DBIx::Class::Schema::Loader::DBI::ODBC::SQL_Anywhere>, |
53 | L<DBIx::Class::Schema::Loader::DBI::ODBC::Firebird>, |
e57fd726 |
54 | L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>, |
55 | L<DBIx::Class::Schema::Loader::DBI> |
56 | |
57 | =head1 AUTHOR |
58 | |
9cc8e7e1 |
59 | See L<DBIx::Class::Schema::Loader/AUTHOR> and L<DBIx::Class::Schema::Loader/CONTRIBUTORS>. |
be80bba7 |
60 | |
61 | =head1 LICENSE |
62 | |
63 | This library is free software; you can redistribute it and/or modify it under |
64 | the same terms as Perl itself. |
e57fd726 |
65 | |
66 | =cut |
67 | |
995edf3f |
68 | 1; |