[Bast-commits] r5752 -
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage
arcanez at dev.catalyst.perl.org
arcanez at dev.catalyst.perl.org
Fri Mar 13 07:11:57 GMT 2009
Author: arcanez
Date: 2009-03-13 07:11:57 +0000 (Fri, 13 Mar 2009)
New Revision: 5752
Modified:
DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI.pm
Log:
rewrite _bind_to_sql to not replace ? with the bindvars, have select return with from_bind
Modified: DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI.pm 2009-03-13 07:10:52 UTC (rev 5751)
+++ DBIx-Class/0.08/branches/count_distinct/lib/DBIx/Class/Storage/DBI.pm 2009-03-13 07:11:57 UTC (rev 5752)
@@ -96,20 +96,11 @@
sub select {
my ($self, $table, $fields, $where, $order, @rest) = @_;
local $self->{having_bind} = [];
+ local $self->{from_bind} = [];
-# if (ref $table eq 'HASH') {
-# my $alias;
-# ($alias, $table) = %$table;
-# }
-
if (ref $table eq 'SCALAR') {
$table = $$table;
}
- elsif (ref $table eq 'REF') {
- my ($sql, @bind) = @{${$table}};
- push(@{$self->{having_bind}}, @bind);
- $table = $sql;
- }
elsif (not ref $table) {
$table = $self->_quote($table);
}
@@ -118,7 +109,7 @@
@rest = (-1) unless defined $rest[0];
die "LIMIT 0 Does Not Compute" if $rest[0] == 0;
# and anyway, SQL::Abstract::Limit will cause a barf if we don't first
- my ($sql, @ret) = $self->SUPER::select(
+ my ($sql, @where_bind) = $self->SUPER::select(
$table, $self->_recurse_fields($fields), $where, $order, @rest
);
$sql .=
@@ -130,7 +121,7 @@
) :
''
;
- return wantarray ? ($sql, @ret, @{$self->{having_bind}}) : $sql;
+ return wantarray ? ($sql, @{$self->{from_bind}}, @where_bind, @{$self->{having_bind}}) : $sql;
}
sub insert {
@@ -278,11 +269,10 @@
}
sub _bind_to_sql {
- my $self = shift;
- my $arr = shift;
- my $sql = shift @$$arr;
- $sql =~ s/\?/$self->_quote((shift @$$arr)->[1])/eg;
- return $sql
+ my ($self, $arr) = @_;
+ my ($sql, @bind) = @{${$arr}};
+ push (@{$self->{from_bind}}, @bind);
+ return $sql;
}
sub _make_as {
More information about the Bast-commits
mailing list