1 package DBIx::Class::Storage::DBI::ADO;
3 use base 'DBIx::Class::Storage::DBI';
12 DBIx::Class::Storage::DBI::ADO - Support for L<DBD::ADO>
16 This class provides a mechanism for discovering and loading a sub-class
17 for a specific ADO backend, as well as some workarounds for L<DBD::ADO>. It
18 should be transparent to the user.
25 my $dbtype = $self->_dbh_get_info(17);
28 warn "Unable to determine ADO driver, failling back to generic support.\n";
34 my $subclass = "DBIx::Class::Storage::DBI::ADO::${dbtype}";
36 return if $self->isa($subclass);
38 if ($self->load_optional_class($subclass)) {
39 bless $self, $subclass;
43 warn "Expected driver '$subclass' not found, using generic support. " .
44 "Please file an RT.\n";
48 # cleanup some warnings from DBD::ADO
49 # RT#65563, not fixed as of DBD::ADO v2.98
53 my $warn_handler = $SIG{__WARN__} || sub { warn @_ };
55 local $SIG{__WARN__} = sub {
57 unless $_[0] =~ m{^Missing argument in sprintf at \S+/ADO/GetInfo\.pm};
60 $self->next::method(@_);
63 # Monkeypatch out the horrible warnings during global destruction.
64 # A patch to DBD::ADO has been submitted as well, and it was fixed
66 # https://rt.cpan.org/Ticket/Display.html?id=65563
68 unless ($DBD::ADO::__DBIC_MONKEYPATCH_CHECKED__) {
71 unless (try { DBD::ADO->VERSION('2.99'); 1 }) {
72 no warnings 'redefine';
73 my $disconnect = *DBD::ADO::db::disconnect{CODE};
75 *DBD::ADO::db::disconnect = subname 'DBD::ADO::db::disconnect' => sub {
76 my $warn_handler = $SIG{__WARN__} || sub { warn @_ };
77 local $SIG{__WARN__} = sub {
79 unless $_[0] =~ /Not a Win32::OLE object|uninitialized value/;
85 $DBD::ADO::__DBIC_MONKEYPATCH_CHECKED__ = 1;
89 # Here I was just experimenting with ADO cursor types, left in as a comment in
90 # case you want to as well. See the DBD::ADO docs.
92 # my ($self, $dbh, $sql) = @_;
94 # my $sth = $self->disable_sth_caching
95 # ? $dbh->prepare($sql, { CursorType => 'adOpenStatic' })
96 # : $dbh->prepare_cached($sql, { CursorType => 'adOpenStatic' }, 3);
98 # $self->throw_exception($dbh->errstr) if !$sth;
107 See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
111 You may distribute this code under the same terms as Perl itself.