1 package DBIx::Class::Storage::DBI::Sybase::NoBindVars;
5 DBIx::Class::Storage::DBI::NoBindVars
6 DBIx::Class::Storage::DBI::Sybase
9 sub _dbh_last_insert_id {
10 my ($self, $dbh, $source, $col) = @_;
12 # @@identity works only if not using placeholders
13 # Should this query be cached?
14 return ($dbh->selectrow_array('select @@identity'))[0];
18 int => qr/^ \-? \d+ $/x,
19 integer => qr/^ \-? \d+ $/x,
20 # TODO maybe need to add float/real/etc
23 sub should_quote_data_type {
25 my ($type, $value) = @_;
27 return $self->next::method(@_) if not defined $value;
29 if (my $re = $noquote->{$type}) {
30 return 0 if $value =~ $re;
33 return $self->next::method(@_);
41 DBIx::Class::Storage::DBI::Sybase::NoBindVars - Storage::DBI subclass for Sybase
42 without placeholder support
46 If you're using this driver than your version of Sybase does not support
47 placeholders. You can check with:
49 $dbh->{syb_dynamic_supported}
51 You can also enable this driver explicitly using:
53 my $schema = SchemaClass->clone;
54 $schema->storage_type('::DBI::Sybase::NoBindVars');
55 $schema->connect($dsn, $user, $pass, \%opts);
57 See the discussion in L<< DBD::Sybase/Using ? Placeholders & bind parameters to
58 $sth->execute >> for details on the pros and cons of using placeholders.
60 One advantage of not using placeholders is that C<select @@identity> will work
61 for obtainging the last insert id of an C<IDENTITY> column, instead of having to
62 do C<select max(col)> as the base Sybase driver does.
64 When using this driver, bind variables will be interpolated (properly quoted of
65 course) into the SQL query itself, without using placeholders.
67 The caching of prepared statements is also explicitly disabled, as the
68 interpolation renders it useless.
72 See L<DBIx::Class/CONTRIBUTORS>.
76 You may distribute this code under the same terms as Perl itself.