From f17f18c476e59123722a6009a8c0e8eef9f25d98 Mon Sep 17 00:00:00 2001 From: alban <alban@octopuce.fr> Date: Sat, 22 Mar 2014 15:46:22 +0100 Subject: [PATCH] =?UTF-8?q?[enh]=C2=A0db=5Fmysql=20:=20adds=20exceptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bureau/class/db_mysql.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bureau/class/db_mysql.php b/bureau/class/db_mysql.php index df422d9e..0d30d11d 100644 --- a/bureau/class/db_mysql.php +++ b/bureau/class/db_mysql.php @@ -159,6 +159,13 @@ class DB_Sql { $this->Row = 0; $this->Errno = mysql_errno(); $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) { $this->halt("Invalid SQL: ".$Query_String); }