When execute() is called with no params then the driver uses the
values previous bound by calls to bind_param(). The driver (or the
underlying database API) ought to check that bind_param() has been
called at least once for each parameter.

Tim.

On Tue, Jun 04, 2002 at 12:21:28PM -0400, Jeff Boes wrote:
> I had no response to this earlier posting.  Has anyone else experienced
> this problem?  Am I doing something stupid here?
> 
> 
> On Thu, 2002-05-30 at 12:05, Jeff Boes wrote:
> > I'm using DBI V1.21, DBD::Pg V1.12.  Given this setup:
> > 
> > #!/usr/bin/perl -w
> > use strict;
> > use DBI;
> > my $dbh = DBI->connect('dbi:Pg:dbname=...')
> >   or die $DBI::errstr;
> > my $sth = $dbh->prepare(q!SELECT * FROM emp WHERE empno=?!)
> >   or die $DBI::errstr;
> > 
> > (that is, a statement handle with a single placeholder)
> > 
> > This call works as expected:
> > 
> > $sth->execute(1) or die $DBI::errstr;
> > 
> > This one produces an error message, as expected:
> > 
> > $sth->execute(1,2) or die $DBI::errstr;
> > 
> > execute called with 2 bind variables, 1 needed
> > 
> > But this one doesn't complain at all!
> > 
> > $sth->execute() or die $DBI::errstr;
> > 
> > Shouldn't execute notice that it has too few parameters in this case? 
> > It notices when you have two placeholders and one value, but if you
> > supply no parameters to execute, it doesn't complain.
> > 
> 
> -- 
> Jeff Boes                                      vox 616.226.9550 ext 24
> Database Engineer                                     fax 616.349.9076
> Nexcerpt, Inc.                                 http://www.nexcerpt.com
>            ...Nexcerpt... Extend your Expertise
> 

Reply via email to