Commit | Line | Data |
---|---|---|
3885cff6 | 1 | package DBIx::Class::Storage::DBI::Sybase; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
2ad62d97 | 5 | |
eabab5d0 | 6 | use base qw/ |
26283ee3 | 7 | DBIx::Class::Storage::DBI::Sybase::Base |
8 | DBIx::Class::Storage::DBI::NoBindVars | |
eabab5d0 | 9 | /; |
2ad62d97 | 10 | use mro 'c3'; |
98259fe4 | 11 | |
47d9646a | 12 | sub _rebless { |
26283ee3 | 13 | my $self = shift; |
c5ce7cd6 | 14 | |
c5ce7cd6 | 15 | my $dbtype = eval { |
26283ee3 | 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; | |
a3a526cc | 25 | $self->_rebless; |
a3a526cc | 26 | } |
6b1f5ef7 | 27 | } |
a3a526cc | 28 | } |
29 | ||
26283ee3 | 30 | sub _dbh_last_insert_id { |
31 | my ($self, $dbh, $source, $col) = @_; | |
32 | return ($dbh->selectrow_array('select @@identity'))[0]; | |
1816be4f | 33 | } |
34 | ||
3885cff6 | 35 | 1; |
36 | ||
26283ee3 | 37 | =head1 NAME |
a3a526cc | 38 | |
26283ee3 | 39 | DBIx::Class::Storage::DBI::Sybase - Storage::DBI subclass for Sybase |
e97a6ee2 | 40 | |
26283ee3 | 41 | =head1 SYNOPSIS |
a3a526cc | 42 | |
26283ee3 | 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>. | |
e97a6ee2 | 46 | |
26283ee3 | 47 | =head1 CAVEATS |
a3a526cc | 48 | |
26283ee3 | 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. | |
5703eb14 | 52 | |
26283ee3 | 53 | More importantly this means that caching of prepared statements is explicitly |
54 | disabled, as the interpolation renders it useless. | |
e97a6ee2 | 55 | |
26283ee3 | 56 | =head1 AUTHORS |
63d46bb3 | 57 | |
26283ee3 | 58 | Brandon L Black <blblack@gmail.com> |
3885cff6 | 59 | |
26283ee3 | 60 | Justin Hunter <justin.d.hunter@gmail.com> |
c5ce7cd6 | 61 | |
3885cff6 | 62 | =head1 LICENSE |
63 | ||
64 | You may distribute this code under the same terms as Perl itself. | |
65 | ||
66 | =cut |