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