Commit | Line | Data |
4ffa5700 |
1 | package # hide from PAUSE |
2 | DBIx::Class::Storage::DBI::ADO; |
3 | |
4 | use base 'DBIx::Class::Storage::DBI'; |
ed7ab0f4 |
5 | use Try::Tiny; |
fd323bf1 |
6 | use namespace::clean; |
4ffa5700 |
7 | |
8 | sub _rebless { |
9 | my $self = shift; |
10 | |
11 | # check for MSSQL |
12 | # XXX This should be using an OpenSchema method of some sort, but I don't know |
13 | # how. |
14 | # Current version is stolen from Sybase.pm |
ed7ab0f4 |
15 | try { |
52b420dd |
16 | my $dbtype = @{$self->_get_dbh |
4ffa5700 |
17 | ->selectrow_arrayref(qq{sp_server_info \@attribute_id=1}) |
52b420dd |
18 | }[2]; |
4ffa5700 |
19 | |
4ffa5700 |
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 | } |
52b420dd |
26 | }; |
4ffa5700 |
27 | } |
28 | |
748eb620 |
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. |
4ffa5700 |
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; |