Merge 'trunk' into 'sybase'
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase / NoBindVars.pm
CommitLineData
6b1f5ef7 1package DBIx::Class::Storage::DBI::Sybase::NoBindVars;
5608593e 2
3use base qw/
4 DBIx::Class::Storage::DBI::NoBindVars
5 DBIx::Class::Storage::DBI::Sybase
6/;
7
6b1f5ef7 8sub _dbh_last_insert_id {
9 my ($self, $dbh, $source, $col) = @_;
10
11 # @@identity works only if not using placeholders
12 # Should this query be cached?
13 return ($dbh->selectrow_array('select @@identity'))[0];
14}
15
5608593e 161;
7e8cecc1 17
18=head1 NAME
19
20DBIx::Class::Storage::DBI::Sybase::NoBindVars - Storage::DBI subclass for Sybase
21without placeholder support
22
23=head1 DESCRIPTION
24
25If you're using this driver than your version of Sybase does not support
26placeholders. You can check with:
27
28 $dbh->{syb_dynamic_supported}
29
30You can also enable this driver explicitly using:
31
32 my $schema = SchemaClass->clone;
33 $schema->storage_type('::DBI::Sybase::NoBindVars');
34 $schema->connect($dsn, $user, $pass, \%opts);
35
36See the discussion in L<< DBD::Sybase/Using ? Placeholders & bind parameters to
37$sth->execute >> for details on the pros and cons of using placeholders.
38
39One advantage of not using placeholders is that C<select @@identity> will work
40for obtainging the last insert id of an C<IDENTITY> column, instead of having to
41do C<select max(col)> as the base Sybase driver does.
42
43When using this driver, bind variables will be interpolated (properly quoted of
44course) into the SQL query itself, without using placeholders.
45
46The caching of prepared statements is also explicitly disabled, as the
47interpolation renders it useless.
48
49=head1 AUTHORS
50
51See L<DBIx::Class/CONTRIBUTORS>.
52
53=head1 LICENSE
54
55You may distribute this code under the same terms as Perl itself.
56
57=cut
58# vim:sts=2 sw=2: