Right, but you never checked if execute() failed with || die() or set the
RaiseError and PrintError to 1. So it never failed. By defauld the error
checking is not turned on, though you must specifically set {RaiseError =>
1, PrintError => 1} or use || die().
Ilya Sterin
-----Original Message-----
From: Julio Santiago
To: Sterin, Ilya; [EMAIL PROTECTED]
Sent: 05/07/2001 10:14 AM
Subject: RE: Error Handling
Here is part of the code:
{
if ($operacion eq "INGRESAR"){
$SQL1="SELECT ID FROM OPERADORES WHERE ID=?";
$buscar_id_operador = $dbh->prepare($SQL1) || die "Couldn't prepare
statement: " . $dbh->errstr;
$buscar_id_operador->execute($codigo);
@data1=$buscar_id_operador->fetchrow_array();
$buscar_id_operador->finish;
if (@data1 != 0){
$mensaje= "Este operador ya existe, por favor vuelva a intertarlo";
}else
eval {
$SQL="INSERT INTO
OPERADORES(HOGAR_PAIS_ID_PAIS,ID,PASSWORD,NOMBRE,CEDULA,DIRECCION,PERFIL
,STATUS,FECHA_CREACION,FECHA_ULT_MODIF)
VALUES (?,?,?,?,?,?,?,?,SYSDATE,SYSDATE)";
$insertar_tipo_caso= $dbh->prepare($SQL) || die "Couldn't prepare
statement: " . $dbh->errstr;
$insertar_tipo_caso->execute($pais_id,$codigo,$passwd,$nombre,$cedula,$d
ireccion,$perfil,$status);
}
if ($@) {
$dbh->rollback;
$mensaje = "Ha ocurrido un error en la aplicacion, vuelva a intentarlo";
} else {
$dbh->commit;
}
$insertar_tipo_caso->finish;
#fin de la insercción
}
The ID field must be a unique name, so if the query finds the same ID it
should return a message. Instead, the application hangs, the db hangs
and I
have to wait 10 to 15 minutes for the db to recover.
Thanks for your help
Julio Santiago
>From: "Sterin, Ilya" <[EMAIL PROTECTED]>
>To: 'Julio Santiago ' <[EMAIL PROTECTED]>, "'[EMAIL PROTECTED]
'"
><[EMAIL PROTECTED]>
>Subject: RE: Error Handling
>Date: Mon, 7 May 2001 09:54:41 -0600
>
>We need a little bit more code than this. What do you mean by $@ not
being
>understood? Are you using eval{}? Is you script failing within
eval{}?
>Are you setting RaiseError => 1 or using || die()?
>
>Ilya Sterin
________________________________________________________________________
_
Get Your Private, Free E-mail from MSN Hotmail at
http://www.hotmail.com.