DBI webserver reports error 503 when SQL-statement returns error. 
Author Message
 DBI webserver reports error 503 when SQL-statement returns error.

hi

in a script running on a webserver, doing UPDATE on a table with a column
that has the property UNIQUE set, when a user tries to change one email
address to an email address that already exists, insted of feching the
error the error kills the process and the webserver reports error 503 to
the user, not very nice.

here is the code that is supposed to update the email address.
i would like to fetch the error somehow so that i can report to the user
that this email is already existing.

how should i do to fetch the error?

---START CODE---
my $dbh = DBI->connect("DBI:mysql:someDB:localhost:3306", '?', '?',
                           { RaiseError => 1, AutoCommit => 1 });

my $sth = $dbh->prepare("UPDATE persons SET email=" .
$dbh->quote($personEmail) . " " .
                            "WHERE personID=" . $dbh->quote($personID)  )
        or warn "\ncannot do UPDATE on persons\n";

    $sth->execute;
    $sth->finish;

$dbh->disconnect;

---END CODE---

thanks
stig



Tue, 20 Sep 2005 04:14:47 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. DBI webserver reports error 503 when SQL-statement returns error.

2. error 503 using RobotUA

3. sql statement ERROR please help......

4. DBD::Oracle PL/SQL statement emulating a SQL statement

5. DBI, DBD:ODBC error with MS SQL Server 6.5

6. Problem with SQL statement in DBI

7. ORA-00900: invalid SQL statement when using Perl DBI::Oracle module

8. dbi:Oracle & SQL statement with date

9. Valid SQL Statement doesn't work in DBI::ODBC

10. DBI SQL statement

11. DBI SQL Statement

12. execute a Perl Programm with DBD:DBI - SQL-Statements in a file

 

 
Powered by phpBB® Forum Software