update Sybase docs
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase / NoBindVars.pm
1 package DBIx::Class::Storage::DBI::Sybase::NoBindVars;
2
3 use base qw/
4   DBIx::Class::Storage::DBI::NoBindVars
5   DBIx::Class::Storage::DBI::Sybase
6 /;
7
8 sub _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
16 1;
17
18 =head1 NAME
19
20 DBIx::Class::Storage::DBI::Sybase::NoBindVars - Storage::DBI subclass for Sybase
21 without placeholder support
22
23 =head1 DESCRIPTION
24
25 If you're using this driver than your version of Sybase does not support
26 placeholders. You can check with:
27
28   $dbh->{syb_dynamic_supported}
29
30 You 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
36 See 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
39 One advantage of not using placeholders is that C<select @@identity> will work
40 for obtainging the last insert id of an C<IDENTITY> column, instead of having to
41 do C<select max(col)> as the base Sybase driver does.
42
43 When using this driver, bind variables will be interpolated (properly quoted of
44 course) into the SQL query itself, without using placeholders.
45
46 The caching of prepared statements is also explicitly disabled, as the
47 interpolation renders it useless.
48
49 =head1 AUTHORS
50
51 See L<DBIx::Class/CONTRIBUTORS>.
52
53 =head1 LICENSE
54
55 You may distribute this code under the same terms as Perl itself.
56
57 =cut
58 # vim:sts=2 sw=2: