All expected evals converted to try, except where no test is done,
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ADO.pm
CommitLineData
4ffa5700 1package # hide from PAUSE
2 DBIx::Class::Storage::DBI::ADO;
3
4use base 'DBIx::Class::Storage::DBI';
ed7ab0f4 5use Try::Tiny;
4ffa5700 6
7sub _rebless {
8 my $self = shift;
9
10# check for MSSQL
11# XXX This should be using an OpenSchema method of some sort, but I don't know
12# how.
13# Current version is stolen from Sybase.pm
ed7ab0f4 14 my $caught;
15 my $dbtype;
16 try {
17 $dbtype = @{$self->_get_dbh
4ffa5700 18 ->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})
19 }[2]
ed7ab0f4 20 } catch {
21 $caught = 1;
4ffa5700 22 };
23
ed7ab0f4 24 unless ($caught) {
4ffa5700 25 $dbtype =~ s/\W/_/gi;
26 my $subclass = "DBIx::Class::Storage::DBI::ADO::${dbtype}";
27 if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
28 bless $self, $subclass;
29 $self->_rebless;
30 }
31 }
32}
33
748eb620 34# Here I was just experimenting with ADO cursor types, left in as a comment in
35# case you want to as well. See the DBD::ADO docs.
4ffa5700 36#sub _dbh_sth {
37# my ($self, $dbh, $sql) = @_;
38#
39# my $sth = $self->disable_sth_caching
40# ? $dbh->prepare($sql, { CursorType => 'adOpenStatic' })
41# : $dbh->prepare_cached($sql, { CursorType => 'adOpenStatic' }, 3);
42#
43# $self->throw_exception($dbh->errstr) if !$sth;
44#
45# $sth;
46#}
47
481;