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; |
4ffa5700 |
6 | |
7 | sub _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 | try { |
52b420dd |
15 | my $dbtype = @{$self->_get_dbh |
4ffa5700 |
16 | ->selectrow_arrayref(qq{sp_server_info \@attribute_id=1}) |
52b420dd |
17 | }[2]; |
4ffa5700 |
18 | |
4ffa5700 |
19 | $dbtype =~ s/\W/_/gi; |
20 | my $subclass = "DBIx::Class::Storage::DBI::ADO::${dbtype}"; |
21 | if ($self->load_optional_class($subclass) && !$self->isa($subclass)) { |
22 | bless $self, $subclass; |
23 | $self->_rebless; |
24 | } |
52b420dd |
25 | }; |
4ffa5700 |
26 | } |
27 | |
748eb620 |
28 | # Here I was just experimenting with ADO cursor types, left in as a comment in |
29 | # case you want to as well. See the DBD::ADO docs. |
4ffa5700 |
30 | #sub _dbh_sth { |
31 | # my ($self, $dbh, $sql) = @_; |
32 | # |
33 | # my $sth = $self->disable_sth_caching |
34 | # ? $dbh->prepare($sql, { CursorType => 'adOpenStatic' }) |
35 | # : $dbh->prepare_cached($sql, { CursorType => 'adOpenStatic' }, 3); |
36 | # |
37 | # $self->throw_exception($dbh->errstr) if !$sth; |
38 | # |
39 | # $sth; |
40 | #} |
41 | |
42 | 1; |