Subject: | Missing bind parameters for statements with HAVING clauses |
Hello,
It seems to me like the @bind array returned should include the binds for the WHERE clause as well as the binds for the "HAVING" statement, which does not currently happen.
I've been able to fix it using the following change (git diff):
index 7c2aa62..40dde39 100644
--- a/SQL/Abstract/Complete.pm
+++ b/SQL/Abstract/Complete.pm
@@ -127,7 +127,11 @@ sub select {
_wipe_space($group_by);
} : undef ),
( ( $meta->{'having'} ) ? do {
- ( my $having = scalar( $self->where( $meta->{'having'} ) ) ) =~ s/\s*WHERE/HAVING/;
+ my ( $having, @having_bind ) = $self->where( $meta->{'having'} );
+ $having =~ s/\s*WHERE/HAVING/;
+ if ( $having and scalar( @having_bind ) ) {
+ push( @bind, @having_bind );
+ }
_wipe_space($having);
} : undef ),
( ( $meta->{'order_by'} ) ? _wipe_space( $self->_order_by( $meta->{'order_by'} ) ) : undef ),
#############################################################
Hope this helps.
Regards,
Dinis