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