On Wed, 22 Jun 2011 15:08:47 +0200, "H.Merijn Brand"
<h.m.br...@xs4all.nl> wrote:

> http://www.perlmonks.org/?node_id=910793
> 
> "You passed $nparm parameters where $n_req required"
> 
> Once was a correct fix. Then all moved from DBD::File to
> DBI::DBD::SqlEngine and now SQL::Statement::Param roars its ugly head :)

With the below fix submitted to DBI about a week ago, [planetscape]
found that that breaks something else:

http://www.perlmonks.org/?node_id=911893

I'm going to do some digging, but it shows we need more tests.

> I'd like to suggest the current fix, for which I am convinced is the
> correct solution (unlit backends change again)
> 
> I do *not* have a testcase for this as I do not see the impact of
> JOIN's and so here
> 
> --8<--- suggested change
> diff --git a/lib/DBI/DBD/SqlEngine.pm b/lib/DBI/DBD/SqlEngine.pm
> index 51f2a0a..bcac88a 100644
> --- a/lib/DBI/DBD/SqlEngine.pm
> +++ b/lib/DBI/DBD/SqlEngine.pm
> @@ -781,7 +781,9 @@ sub execute
>      {
>          # bug in SQL::Statement 1.20 and below causes breakage
>          # on all but the first call
> -        unless ( ( my $req_prm = $stmt->params() ) == ( my $nparm = @$params 
> ) )
> +        my @req_prm = $stmt->params ();
> +        my $n_req = @req_prm == 1 && ref $req_prm[0] ? $req_prm[0]->num : 
> scalar @req_prm;
> +        unless ( $n_req == ( my $nparm = @$params ) )
>          {
>              my $msg = "You passed $nparm parameters where $req_prm required";
>              $sth->set_err( $DBI::stderr, $msg );
> -->8---
> 


-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Reply via email to