Release 0.07047
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBI / ADO.pm
1 package DBIx::Class::Schema::Loader::DBI::ADO;
2
3 use strict;
4 use warnings;
5 use base 'DBIx::Class::Schema::Loader::DBI';
6 use mro 'c3';
7
8 our $VERSION = '0.07047';
9
10 =head1 NAME
11
12 DBIx::Class::Schema::Loader::DBI::ADO - L<DBD::ADO> proxy
13
14 =head1 DESCRIPTION
15
16 Reblesses into an C<::ADO::> class when connecting via L<DBD::ADO>.
17
18 See L<DBIx::Class::Schema::Loader::Base> for usage information.
19
20 =cut
21
22 sub _rebless {
23     my $self = shift;
24
25     return if ref $self ne __PACKAGE__;
26
27     my $dbh  = $self->schema->storage->dbh;
28     my $dbtype = eval { $dbh->get_info(17) };
29     unless ( $@ ) {
30         # Translate the backend name into a perl identifier
31         $dbtype =~ s/\W/_/gi;
32         my $class = "DBIx::Class::Schema::Loader::DBI::ADO::${dbtype}";
33         if ($self->load_optional_class($class) && !$self->isa($class)) {
34             bless $self, $class;
35             $self->_rebless;
36         }
37     }
38 }
39
40 sub _filter_tables {
41     my $self = shift;
42
43     local $^W = 0; # turn off exception printing from Win32::OLE
44
45     $self->next::method(@_);
46 }
47
48 =head1 SEE ALSO
49
50 L<DBIx::Class::Schema::Loader::DBI::ADO::Microsoft_SQL_Server>,
51 L<DBIx::Class::Schema::Loader::DBI::ADO::MS_Jet>,
52 L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,
53 L<DBIx::Class::Schema::Loader::DBI>
54
55 =head1 AUTHORS
56
57 See L<DBIx::Class::Schema::Loader/AUTHORS>.
58
59 =head1 LICENSE
60
61 This library is free software; you can redistribute it and/or modify it under
62 the same terms as Perl itself.
63
64 =cut
65
66 1;