1 package DBIx::Class::Storage::DBI::ADO;
3 use base 'DBIx::Class::Storage::DBI';
11 DBIx::Class::Storage::DBI::ADO - Support for L<DBD::ADO>
15 This class provides a mechanism for discovering and loading a sub-class
16 for a specific ADO backend, as well as some workarounds for L<DBD::ADO>. It
17 should be transparent to the user.
24 my $dbtype = $self->_dbh_get_info(17);
27 warn "Unable to determine ADO driver, failling back to generic support.\n";
33 my $subclass = "DBIx::Class::Storage::DBI::ADO::${dbtype}";
35 return if $self->isa($subclass);
37 if ($self->load_optional_class($subclass)) {
38 bless $self, $subclass;
42 warn "Expected driver '$subclass' not found, using generic support. " .
43 "Please file an RT.\n";
47 # cleanup some warnings from DBD::ADO
48 # RT#65563, not fixed as of DBD::ADO v2.98
52 my $warn_handler = $SIG{__WARN__} || sub { warn @_ };
54 local $SIG{__WARN__} = sub {
56 unless $_[0] =~ m{^Missing argument in sprintf at \S+/ADO/GetInfo\.pm};
59 $self->next::method(@_);
62 # Monkeypatch out the horrible warnings during global destruction.
63 # A patch to DBD::ADO has been submitted as well.
64 # https://rt.cpan.org/Ticket/Display.html?id=65563
66 no warnings 'redefine';
69 if ($DBD::ADO::VERSION <= 2.98) {
70 my $disconnect = *DBD::ADO::db::disconnect{CODE};
72 *DBD::ADO::db::disconnect = subname 'DBD::ADO::db::disconnect' => sub {
73 my $warn_handler = $SIG{__WARN__} || sub { warn @_ };
74 local $SIG{__WARN__} = sub {
76 unless $_[0] =~ /Not a Win32::OLE object|uninitialized value/;
83 # Here I was just experimenting with ADO cursor types, left in as a comment in
84 # case you want to as well. See the DBD::ADO docs.
86 # my ($self, $dbh, $sql) = @_;
88 # my $sth = $self->disable_sth_caching
89 # ? $dbh->prepare($sql, { CursorType => 'adOpenStatic' })
90 # : $dbh->prepare_cached($sql, { CursorType => 'adOpenStatic' }, 3);
92 # $self->throw_exception($dbh->errstr) if !$sth;
101 See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
105 You may distribute this code under the same terms as Perl itself.