[enh] db_mysql : adds exceptions

This commit is contained in:
alban 2014-03-22 15:46:22 +01:00
parent 6bf962400a
commit f17f18c476
1 changed files with 7 additions and 0 deletions

View File

@ -159,6 +159,13 @@ class DB_Sql {
$this->Row = 0; $this->Row = 0;
$this->Errno = mysql_errno(); $this->Errno = mysql_errno();
$this->Error = mysql_error(); $this->Error = mysql_error();
if( 0 != $this->Errno ){
if( defined("THROW_EXCEPTIONS") && THROW_EXCEPTIONS ){
throw new \Exception("Mysql query failed : $this->Error");
}
$this->halt("SQL Error: ".$Query_String);
return FALSE;
}
if (!$this->Query_ID) { if (!$this->Query_ID) {
$this->halt("Invalid SQL: ".$Query_String); $this->halt("Invalid SQL: ".$Query_String);
} }