Release 0.07038
[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.07038';
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 _tables_list {
41     my ($self, $opts) = @_;
42
43     return $self->next::method($opts, undef, undef);
44 }
45
46 sub _filter_tables {
47     my $self = shift;
48
49     local $^W = 0; # turn off exception printing from Win32::OLE
50
51     $self->next::method(@_);
52 }
53
54 =head1 SEE ALSO
55
56 L<DBIx::Class::Schema::Loader::DBI::ADO::Microsoft_SQL_Server>,
57 L<DBIx::Class::Schema::Loader::DBI::ADO::MS_Jet>,
58 L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,
59 L<DBIx::Class::Schema::Loader::DBI>
60
61 =head1 AUTHOR
62
63 See L<DBIx::Class::Schema::Loader/AUTHOR> and L<DBIx::Class::Schema::Loader/CONTRIBUTORS>.
64
65 =head1 LICENSE
66
67 This library is free software; you can redistribute it and/or modify it under
68 the same terms as Perl itself.
69
70 =cut
71
72 1;