From bc61fa53260dc4ba4beed7aacd42d1b076e330a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Skej=C3=B8?= Date: Mon, 1 Jun 2009 21:53:58 +0200 Subject: [PATCH] AOOSMysqlInterface: Use exceptions in a better way --- lib/AOOSMysqlInterface.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/AOOSMysqlInterface.php b/lib/AOOSMysqlInterface.php index d92c30a..f3f6a41 100644 --- a/lib/AOOSMysqlInterface.php +++ b/lib/AOOSMysqlInterface.php @@ -56,7 +56,7 @@ class AOOSMysqlInterface extends AOOSModule implements AOOSStorageInterface $this->_queryText = $query; if (!($this->_query = mysql_query($this->_queryText))) { - throw new AOOSException($this->core(), $this->tr("mysql_query_fail"), $this->tr("error").": ".mysql_error()."
Query: ".$query); + $e = new AOOSException($this->core(), $this->tr("mysql_query_fail"), $this->tr("error").": ".mysql_error()."
Query: ".$query, true, 0); return false; } @@ -114,8 +114,10 @@ class AOOSMysqlInterface extends AOOSModule implements AOOSStorageInterface $query .= " ORDER BY ".$o; } - if (!$this->_makeQuery($query)) { - return false; + try { + $this->_makeQuery($query); + } catch (AOOSException $e) { + throw $e; } $a = array(); while ($row = mysql_fetch_assoc($this->_query)) { @@ -205,6 +207,7 @@ class AOOSMysqlInterface extends AOOSModule implements AOOSStorageInterface case(AOOSMODEL_TYPE_STRING): $t .= " TEXT"; break; + case(AOOSMODEL_TYPE_DATETIME): case(AOOSMODEL_TYPE_INTEGER): $t .= " INT(11)"; if ($props[$field] & AOOSMODEL_PROP_DATA_INCREASING) { -- 2.11.4.GIT