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 if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
36 bless $self, $subclass;
40 warn "Expected driver '$subclass' not found, using generic support. " .
41 "Please file an RT.\n";
45 # cleanup some warnings from DBD::ADO
46 # RT#65563, not fixed as of DBD::ADO v2.98
50 my $warn_handler = $SIG{__WARN__} || sub { warn @_ };
52 local $SIG{__WARN__} = sub {
54 unless $_[0] =~ m{^Missing argument in sprintf at \S+/ADO/GetInfo\.pm};
57 $self->next::method(@_);
60 # Monkeypatch out the horrible warnings during global destruction.
61 # A patch to DBD::ADO has been submitted as well.
62 # https://rt.cpan.org/Ticket/Display.html?id=65563
64 no warnings 'redefine';
67 if ($DBD::ADO::VERSION <= 2.98) {
68 my $disconnect = *DBD::ADO::db::disconnect{CODE};
70 *DBD::ADO::db::disconnect = subname 'DBD::ADO::db::disconnect' => sub {
71 my $warn_handler = $SIG{__WARN__} || sub { warn @_ };
72 local $SIG{__WARN__} = sub {
74 unless $_[0] =~ /Not a Win32::OLE object|uninitialized value/;
81 # Here I was just experimenting with ADO cursor types, left in as a comment in
82 # case you want to as well. See the DBD::ADO docs.
84 # my ($self, $dbh, $sql) = @_;
86 # my $sth = $self->disable_sth_caching
87 # ? $dbh->prepare($sql, { CursorType => 'adOpenStatic' })
88 # : $dbh->prepare_cached($sql, { CursorType => 'adOpenStatic' }, 3);
90 # $self->throw_exception($dbh->errstr) if !$sth;
99 See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
103 You may distribute this code under the same terms as Perl itself.