1 package DBIx::Class::Storage::DBI::NoBindVars;
6 use base 'DBIx::Class::Storage::DBI';
9 my ($self, $op, $extra_bind, $ident, @args) = @_;
10 my ($sql, @bind) = $self->sql_maker->$op($ident, @args);
11 unshift(@bind, @$extra_bind) if $extra_bind;
13 my @debug_bind = map { defined $_ ? qq{'$_'} : q{'NULL'} } @bind;
14 $self->debugobj->query_start($sql, @debug_bind);
17 while(my $bvar = shift @bind) {
18 $bvar = $self->_dbh->quote($bvar);
22 my $sth = eval { $self->sth($sql,$op) };
25 $self->throw_exception(
26 'no sth generated via sql (' . ($@ || $self->_dbh->errstr) . "): $sql"
33 $rv = eval { $sth->execute };
36 $self->throw_exception("Error executing '$sql': ".($@ || $sth->errstr));
39 $self->throw_exception("'$sql' did not generate a statement.");
42 my @debug_bind = map { defined $_ ? qq{`$_'} : q{`NULL'} } @bind;
43 $self->debugobj->query_end($sql, @debug_bind);
45 return (wantarray ? ($rv, $sth, @bind) : $rv);
52 DBIx::Class::Storage::DBI::NoBindVars - Sometime DBDs have poor to no support for bind variables
58 This class allows queries to work when the DBD or underlying library does not
59 support the usual C<?> placeholders, or at least doesn't support them very
60 well, as is the case with L<DBD::Sybase>
64 Brandon Black <blblack@gmail.com>
65 Trym Skaar <trym@tryms.no>
69 You may distribute this code under the same terms as Perl itself.