From 429485445f593f1d8cd98a9c319d3c0c43c331c7 Mon Sep 17 00:00:00 2001 From: lpotherat Date: Fri, 29 Mar 2013 09:26:10 +0100 Subject: [PATCH] Update connector.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fetch() and fetchAll() : set default value to "BOTH" to avoid ambiguity - fetchAll() : passing $mode arg to PDOStatement->fetchAll(). - getFetchConstant() : removing breaks, useless with return. Grouping default with "BOTH" and "MYSQL_BOTH" --- core/common/class/db/pdo/connector.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/core/common/class/db/pdo/connector.php b/core/common/class/db/pdo/connector.php index 2b131f3..5b407e9 100644 --- a/core/common/class/db/pdo/connector.php +++ b/core/common/class/db/pdo/connector.php @@ -158,14 +158,14 @@ public function rowCount(){ /* FETCH */ //MODES : PDO::FETCH_ASSOC | PDO::FETCH_BOTH | PDO::FETCH_BOUND | PDO::FETCH_CLASS | PDO::FETCH_INTO | PDO::FETCH_LAZY | PDO::FETCH_NUM | PDO::FETCH_OBJ - public function fetch($mode = ""){ + public function fetch($mode = "BOTH"){ return $this->_db_result->fetch($this->getFetchConstant($mode)); } /* FETCH ALL */ - public function fetchAll($mode = ""){ + public function fetchAll($mode = "BOTH"){ $this->execute(); - return $this->_db_result->fetchAll(); + return $this->_db_result->fetchAll($this->getFetchConstant($mode)); } /* RESULT CLOSE */ @@ -188,18 +188,14 @@ private function getFetchConstant($mode){ case "ASSOC": case "MYSQL_ASSOC": return PDO::FETCH_ASSOC; - break; case "NUM": case "MYSQL_NUM": return PDO::FETCH_NUM; - break; case "BOTH": case "MYSQL_BOTH": - return PDO::FETCH_BOTH; - break; default: return PDO::FETCH_BOTH; } } } -?> \ No newline at end of file +?>