Re: Clarification on DBI module
- From: Tim.Bunce@xxxxxxxxx (Tim Bunce)
- Date: Thu, 10 May 2007 17:04:46 +0100
On Thu, May 10, 2007 at 02:50:10PM +0200, Peter J. Holzer wrote:
On 2007-05-10 07:50:16 -0400, Jeffrey Seger wrote:
On your execution without a bound value, are you actually looking for rows
where the empno column is null? If so, try this:
instead of
my @bind1 = ();
try:
my @bind1 = (undef);
Otherwise, what exactly are you looking for?
As I understood Ramesh, the code wasn't supposed to do anything useful.
He expected an error (e.g. "DBD::Oracle::st execute failed: called with
0 bind variables when 1 are needed"), but instead got a result.
While the behaviour is documented (if you read closely enough), and also
useful, it is somewhat surprising:
When you use 2 placeholders in your query, and then invoke execute with
1 or 3 parameters, you get an error, that the number of bind variables
doesn't match the prepared query. But if you invoke execute with 0
parameters, you don't get such an error.
I don't see how this behaviour could be changed without breaking
existing code, though.
It can't as there's no way [*] for the execute() to distinguish
between $sth->execute() and $sth->execute(@empty_array).
Tim.
[*] Well, no sufficiently easy way. I could write the C code to dig
through perls internal op tree to see if there was an argument array,
but that seems like more pain than gain. Patches welcome, naturally.
.
- References:
- Re: Clarification on DBI module
- From: John Scoles
- Re: Clarification on DBI module
- From: Ramesh Thangamani
- Re: Clarification on DBI module
- From: Jeffrey Seger
- Re: Clarification on DBI module
- From: Peter J. Holzer
- Re: Clarification on DBI module
- Prev by Date: Re: temporary table "disapears"
- Next by Date: DBI - DBD with Oracle 10g on Windows XP
- Previous by thread: Re: Clarification on DBI module
- Next by thread: Re: Clarification on DBI module
- Index(es):