Introduce GOVERNANCE document and empty RESOLUTIONS file.
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ADO.pm
CommitLineData
56dca25f 1package DBIx::Class::Storage::DBI::ADO;
4ffa5700 2
4a233f30 3use warnings;
4use strict;
5
4ffa5700 6use base 'DBIx::Class::Storage::DBI';
56dca25f 7use mro 'c3';
4ffa5700 8
514b84f6 9use DBIx::Class::_Util qw( sigwarn_silencer modver_gt_or_eq set_subname );
772a1a25 10use namespace::clean;
11
56dca25f 12=head1 NAME
13
14DBIx::Class::Storage::DBI::ADO - Support for L<DBD::ADO>
15
16=head1 DESCRIPTION
17
18This class provides a mechanism for discovering and loading a sub-class
19for a specific ADO backend, as well as some workarounds for L<DBD::ADO>. It
20should be transparent to the user.
21
22=cut
23
75d3bdb2 24sub _rebless { shift->_determine_connector_driver('ADO') }
56dca25f 25
26# cleanup some warnings from DBD::ADO
27# RT#65563, not fixed as of DBD::ADO v2.98
28sub _dbh_get_info {
29 my $self = shift;
30
052a832c 31 local $SIG{__WARN__} = sigwarn_silencer(
32 qr{^Missing argument in sprintf at \S+/ADO/GetInfo\.pm}
33 );
56dca25f 34
35 $self->next::method(@_);
4ffa5700 36}
37
772a1a25 38# Monkeypatch out the horrible warnings during global destruction.
8892d8e5 39# A patch to DBD::ADO has been submitted as well, and it was fixed
40# as of 2.99
772a1a25 41# https://rt.cpan.org/Ticket/Display.html?id=65563
42sub _init {
8892d8e5 43 unless ($DBD::ADO::__DBIC_MONKEYPATCH_CHECKED__) {
44 require DBD::ADO;
45
7302b3e0 46 unless ( modver_gt_or_eq( 'DBD::ADO', '2.99' ) ) {
8892d8e5 47 no warnings 'redefine';
48 my $disconnect = *DBD::ADO::db::disconnect{CODE};
49
514b84f6 50 *DBD::ADO::db::disconnect = set_subname 'DBD::ADO::db::disconnect' => sub {
052a832c 51 local $SIG{__WARN__} = sigwarn_silencer(
52 qr/Not a Win32::OLE object|uninitialized value/
53 );
8892d8e5 54 $disconnect->(@_);
772a1a25 55 };
8892d8e5 56 }
57
58 $DBD::ADO::__DBIC_MONKEYPATCH_CHECKED__ = 1;
772a1a25 59 }
60}
61
748eb620 62# Here I was just experimenting with ADO cursor types, left in as a comment in
63# case you want to as well. See the DBD::ADO docs.
9930caaf 64#sub _prepare_sth {
4ffa5700 65# my ($self, $dbh, $sql) = @_;
66#
67# my $sth = $self->disable_sth_caching
68# ? $dbh->prepare($sql, { CursorType => 'adOpenStatic' })
69# : $dbh->prepare_cached($sql, { CursorType => 'adOpenStatic' }, 3);
70#
71# $self->throw_exception($dbh->errstr) if !$sth;
72#
73# $sth;
74#}
75
a2bd3796 76=head1 FURTHER QUESTIONS?
56dca25f 77
a2bd3796 78Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
56dca25f 79
a2bd3796 80=head1 COPYRIGHT AND LICENSE
56dca25f 81
a2bd3796 82This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
83by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
84redistribute it and/or modify it under the same terms as the
85L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
56dca25f 86
87=cut
a2bd3796 88
891;
90
56dca25f 91# vim:sts=2 sw=2: