On 05-Jul-2006 Tim Bunce wrote:
> On Wed, Jul 05, 2006 at 01:38:04PM +0100, Martin J. Evans wrote:
>> Tim,
>> 
>> Thanks for the clarification and "untested" patch. I've tried it and it now
>> fails (returns undef) and the HandleError routine is called. The error I'm
>> getting now is:
>> 
>> executing ARRAY(0x8ce4c08) generated 1
> 
> D'oh. Thanks.
> 
>> Changing your patch to:
>> 
>> return $sth->set_err(1, "executing " . join(",", @{$tuple_status}) . "
>> generated $err_count errors")
>> 
>> is every so slightly more useful, since it produces:
>> 
>> executing 1,ARRAY(0x981d698),1,1 generated 1 errors
>> 
>> which makes it obvious which row failed.
> 
> You might not think it more useful if the batch had 10,000 tuples in it!
> I think I'll stick with just a count.

Argh, yes, good point.

>> The error handler gets a better error message of:
>> 
>> DBD::Oracle::st execute_array failed: executing 1,ARRAY(0x8869c08),1,1
>> generated 1 errors [for Statement "insert into mytest values (?,?)" with
>> ParamValues: :p1=53, :p2='one']
> 
> Um, including ParamValues is somewhat misleading in this situation.

Yes, I meant to mention that - the params given are the last ones in the array
and not the failing ones which were :p1=1 and :p2='fiftytwo' in this case.

>> Just one note. This breaks t/15array.t around about line 48 because the test
>> has RaiseError and PrintError turned on and expects the execute_array to
>> fail.
>> Turning them off before the test and back on again after fixes.
> 
> Thanks.
> 
> Try the attached patch on top of the previous one.

Done - works better:

I know get:

executing 4 generated 1 errors

which is correct.

execute_array still returns undef - good.

the two new tests in 15array.t pass and the original one I mentioned passes
"although" it still throws

t/15array................ok 1/52DBD::Sponge::st execute_array failed: executing
3 generated 1 errors at t/15array.t line 48.

on stdout (PrintError?).

Thanks.

Martin
--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com

Reply via email to