Backout sybase changes
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase.pm
1 package DBIx::Class::Storage::DBI::Sybase;
2
3 use strict;
4 use warnings;
5
6 use base qw/
7     DBIx::Class::Storage::DBI::Sybase::Base
8     DBIx::Class::Storage::DBI::NoBindVars
9 /;
10 use mro 'c3';
11
12 sub _rebless {
13     my $self = shift;
14
15     my $dbtype = eval {
16       @{$self->_get_dbh
17         ->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})
18       }[2]
19     };
20     unless ( $@ ) {
21         $dbtype =~ s/\W/_/gi;
22         my $subclass = "DBIx::Class::Storage::DBI::Sybase::${dbtype}";
23         if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
24             bless $self, $subclass;
25             $self->_rebless;
26         }
27     }
28 }
29
30 sub _dbh_last_insert_id {
31     my ($self, $dbh, $source, $col) = @_;
32     return ($dbh->selectrow_array('select @@identity'))[0];
33 }
34
35 1;
36
37 =head1 NAME
38
39 DBIx::Class::Storage::DBI::Sybase - Storage::DBI subclass for Sybase
40
41 =head1 SYNOPSIS
42
43 This subclass supports L<DBD::Sybase> for real Sybase databases.  If
44 you are using an MSSQL database via L<DBD::Sybase>, see
45 L<DBIx::Class::Storage::DBI::Sybase::MSSQL>.
46
47 =head1 CAVEATS
48
49 This storage driver uses L<DBIx::Class::Storage::DBI::NoBindVars> as a base.
50 This means that bind variables will be interpolated (properly quoted of course)
51 into the SQL query itself, without using bind placeholders.
52
53 More importantly this means that caching of prepared statements is explicitly
54 disabled, as the interpolation renders it useless.
55
56 =head1 AUTHORS
57
58 Brandon L Black <blblack@gmail.com>
59
60 Justin Hunter <justin.d.hunter@gmail.com>
61
62 =head1 LICENSE
63
64 You may distribute this code under the same terms as Perl itself.
65
66 =cut