X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2FODBC.pm;h=47acea32b602c2f7405bc40aa10f985433c993fe;hb=38a64290c6c15538795ff18e6bc6c1ddcb67aab3;hp=b4cdec3e38318693da998a26e5fbff1673f91d9c;hpb=995edf3f035cbd35082df6d41230e84472ba4270;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm b/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm index b4cdec3..47acea3 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm @@ -3,24 +3,60 @@ package DBIx::Class::Schema::Loader::DBI::ODBC; use strict; use warnings; use base 'DBIx::Class::Schema::Loader::DBI'; -use Carp::Clan qw/^DBIx::Class/; -use Class::C3; +use mro 'c3'; -our $VERSION = '0.04999_06'; +our $VERSION = '0.07049'; + +=head1 NAME + +DBIx::Class::Schema::Loader::DBI::ODBC - L proxy + +=head1 DESCRIPTION + +Reblesses into an C<::ODBC::> class when connecting via L. + +Code stolen from the L ODBC storage. + +See L for usage information. + +=cut sub _rebless { - my $self = shift; - my $dbh = $self->schema->storage->dbh; - -# stolen from DBIC ODBC driver for MSSQL - my $dbtype = eval { $dbh->get_info(17) }; - unless ( $@ ) { - # Translate the backend name into a perl identifier - $dbtype =~ s/\W/_/gi; - my $class = "DBIx::Class::Schema::Loader::DBI::ODBC::${dbtype}"; - eval "require $class"; - bless $self, $class unless $@; - } + my $self = shift; + + return if ref $self ne __PACKAGE__; + + # stolen from DBIC ODBC storage + my $dbh = $self->schema->storage->dbh; + my $dbtype = eval { $dbh->get_info(17) }; + unless ( $@ ) { + # Translate the backend name into a perl identifier + $dbtype =~ s/\W/_/gi; + my $class = "DBIx::Class::Schema::Loader::DBI::ODBC::${dbtype}"; + if ($self->load_optional_class($class) && !$self->isa($class)) { + bless $self, $class; + $self->_rebless; + } + } } +=head1 SEE ALSO + +L, +L, +L, +L, L, +L + +=head1 AUTHORS + +See L. + +=head1 LICENSE + +This library is free software; you can redistribute it and/or modify it under +the same terms as Perl itself. + +=cut + 1;