a few more Moose Type related fixes and added diag to the replication test to report...
[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 { @{$self->dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2] };
16     unless ( $@ ) {
17         $dbtype =~ s/\W/_/gi;
18         my $subclass = "DBIx::Class::Storage::DBI::Sybase::${dbtype}";
19         if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
20             bless $self, $subclass;
21             $self->_rebless;
22         }
23     }
24 }
25
26 sub _dbh_last_insert_id {
27     my ($self, $dbh, $source, $col) = @_;
28     return ($dbh->selectrow_array('select @@identity'))[0];
29 }
30
31 1;
32
33 =head1 NAME
34
35 DBIx::Class::Storage::DBI::Sybase - Storage::DBI subclass for Sybase
36
37 =head1 SYNOPSIS
38
39 This subclass supports L<DBD::Sybase> for real Sybase databases.  If
40 you are using an MSSQL database via L<DBD::Sybase>, see
41 L<DBIx::Class::Storage::DBI::Sybase::MSSQL>.
42
43 =head1 CAVEATS
44
45 This storage driver uses L<DBIx::Class::Storage::DBI::NoBindVars> as a base.
46 This means that bind variables will be interpolated (properly quoted of course)
47 into the SQL query itself, without using bind placeholders.
48
49 More importantly this means that caching of prepared statements is explicitly
50 disabled, as the interpolation renders it useless.
51
52 =head1 AUTHORS
53
54 Brandon L Black <blblack@gmail.com>
55
56 Justin Hunter <justin.d.hunter@gmail.com>
57
58 =head1 LICENSE
59
60 You may distribute this code under the same terms as Perl itself.
61
62 =cut