Release 0.07047
[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';
995edf3f 7
306bf770 8our $VERSION = '0.07047';
995edf3f 9
e57fd726 10=head1 NAME
11
8793567f 12DBIx::Class::Schema::Loader::DBI::ODBC - L<DBD::ODBC> proxy
e57fd726 13
14=head1 DESCRIPTION
15
8793567f 16Reblesses into an C<::ODBC::> class when connecting via L<DBD::ODBC>.
e57fd726 17
18Code stolen from the L<DBIx::Class> ODBC storage.
19
20See L<DBIx::Class::Schema::Loader::Base> for usage information.
21
22=cut
23
995edf3f 24sub _rebless {
83bce685 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 }
b5e1caf2 40 }
995edf3f 41}
42
e57fd726 43=head1 SEE ALSO
44
45L<DBIx::Class::Schema::Loader::DBI::ODBC::Microsoft_SQL_Server>,
71a6e88a 46L<DBIx::Class::Schema::Loader::DBI::ODBC::SQL_Anywhere>,
47L<DBIx::Class::Schema::Loader::DBI::ODBC::Firebird>,
e57fd726 48L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,
49L<DBIx::Class::Schema::Loader::DBI>
50
b87ab391 51=head1 AUTHORS
e57fd726 52
b87ab391 53See L<DBIx::Class::Schema::Loader/AUTHORS>.
be80bba7 54
55=head1 LICENSE
56
57This library is free software; you can redistribute it and/or modify it under
58the same terms as Perl itself.
e57fd726 59
60=cut
61
995edf3f 621;