X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSQLAHacks.pm;h=392c887ba10fce46aede68c00749da03cca8eeb3;hb=583a0c658da959793c4cbcc4d882da8550b23f6c;hp=c1fbb40200a107b2d401eaaca93e4aa0cbda7d59;hpb=ea8d89387cd3e55447ed76c3898a682a0b7854f5;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/SQLAHacks.pm b/lib/DBIx/Class/SQLAHacks.pm index c1fbb40..392c887 100644 --- a/lib/DBIx/Class/SQLAHacks.pm +++ b/lib/DBIx/Class/SQLAHacks.pm @@ -508,8 +508,6 @@ sub _find_syntax { sub select { my ($self, $table, $fields, $where, $rs_attrs, @rest) = @_; - $self->{"${_}_bind"} = [] for (qw/having from order where/); - if (not ref($table) or ref($table) eq 'SCALAR') { $table = $self->_quote($table); } @@ -522,7 +520,16 @@ sub select { ($sql, @{$self->{where_bind}}) = $self->SUPER::select( $table, $self->_recurse_fields($fields), $where, $rs_attrs, @rest ); - return wantarray ? ($sql, @{$self->{from_bind}}, @{$self->{where_bind}}, @{$self->{having_bind}}, @{$self->{order_bind}} ) : $sql; + +# this *must* be called, otherwise extra binds will remain in the sql-maker + my @bind = $self->_assemble_binds; + + return wantarray ? ($sql, @bind) : $sql; +} + +sub _assemble_binds { + my $self = shift; + return map { @{ (delete $self->{"${_}_bind"}) || [] } } (qw/from where having order/); } # Quotes table names, and handles default inserts