Re: Is it correct that execute_array does not raise/print an error
- From: martin.evans@xxxxxxxxxxxx (Martin J. Evans)
- Date: Tue, 04 Jul 2006 13:03:54 +0100 (BST)
On 04-Jul-2006 John Scoles wrote:
It memory serves me correctly I think any errors that are generated is
stored in the ArrayTupleStatus have a parse through that array to see it the
error is stored there.
John,
They are stored in the ArrayTupleStatus. I'm not saying I can't get them, but I
rather thought since they were errors that RaiseError would cause a die and
that my HandleError routine would be called - neither seems to occur. Unless
I'm mistaken this seems to make execute_array a special case and thus
RaiseError should say it causes a die for all error in methods except
execute_array (and similarly for HandleError).
Martin
--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com
----- Original Message -----
From: "Martin J. Evans" <martin.evans@xxxxxxxxxxxx>
To: <dbi-users@xxxxxxxx>
Sent: Tuesday, July 04, 2006 6:37 AM
Subject: Is it correct that execute_array does not raise/print an error
Hi,that an
I have some code which uses execute_array but it appears when it fails
my error handler is not called and no error is printed despite setting
PrintError and RaiseError. The script below illustrates. Is it correct
error can occur in execute_array and it not cause a die when RaiseError isset?
\@tuple_status } );
use DBI;
use strict;
use Data::Dumper;
sub fred
{
print "Error Handler called\n";
print Dumper(\@_);
}
my $dbh = DBI->connect(
'DBI:mysql:mjetest', 'xxx', 'yyy',
{ RaiseError => 1, PrintError => 1, HandleError => \&fred});
$dbh->do(q/drop table if exists mytest/);
$dbh->do(q/create table mytest (a int primary key, b char(20))/);
my $sth = $dbh->prepare(q/insert into mytest values (?,?)/);
$sth->bind_param(1, 1);
$sth->bind_param(2, 'onetwothree');
$sth->execute;
$sth->bind_param_array(1, [51,1,52,53]);
$sth->bind_param_array(2, ['fiftyone', 'fiftytwo', 'fiftythree', 'one']);
my @tuple_status;
my $inserted = $sth->execute_array( { ArrayTupleStatus =>
print "Error from execute_array - $DBI::errstr\n" if (!$inserted);at
which produces:
Error from execute_array -
even though the trace indicates:
<- prepare('insert into mytest values (?,?)')= DBI::st=HASH(0x82a1b80)
execute_array.pl line 17
<- bind_param(1 1)= 1 at execute_array.pl line 18
<- bind_param(2 'onetwothree')= 1 at execute_array.pl line 19
<- execute= 1 at execute_array.pl line 20
<- bind_param_array(1 ARRAY(0x829d4f8))= 1 at execute_array.pl line 22
<- bind_param_array(2 ARRAY(0x829d534))= 1 at execute_array.pl line 23
<- execute_array(HASH(0x829d5c4))= undef at execute_array.pl line 26
Thanks
Martin
--
Martin J. Evans
Easysoft Ltd, UK
http://www.easysoft.com
.
- Follow-Ups:
- Re: Is it correct that execute_array does not raise/print an error
- From: John Scoles
- Re: Is it correct that execute_array does not raise/print an error
- References:
- Re: Is it correct that execute_array does not raise/print an error
- From: John Scoles
- Re: Is it correct that execute_array does not raise/print an error
- Prev by Date: Re: DBD::Informix on Solaris
- Next by Date: Re: Is it correct that execute_array does not raise/print an error
- Previous by thread: Re: Is it correct that execute_array does not raise/print an error
- Next by thread: Re: Is it correct that execute_array does not raise/print an error
- Index(es):