Browse Source

Using an explicit fetch mode in all calls to PDOStatement::fetch, this also reduces the memory usage

Jose Lorenzo Rodriguez 14 years ago
parent
commit
e5c312f4b5
1 changed files with 3 additions and 3 deletions
  1. 3 3
      lib/Cake/Model/Datasource/Database/Mysql.php

+ 3 - 3
lib/Cake/Model/Datasource/Database/Mysql.php

@@ -196,7 +196,7 @@ class Mysql extends DboSource {
 		} else {
 			$tables = array();
 
-			while ($line = $result->fetch()) {
+			while ($line = $result->fetch(PDO::FETCH_NUM)) {
 				$tables[] = $line[0];
 			}
 
@@ -280,7 +280,7 @@ class Mysql extends DboSource {
 	public function getCharsetName($name) {
 		if ((bool)version_compare($this->getVersion(), "5", ">=")) {
 			$r = $this->_execute('SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME = ?', array($name));
-			$cols = $r->fetch();
+			$cols = $r->fetch(PDO::FETCH_ASSOC);
 
 			if (isset($cols['CHARACTER_SET_NAME'])) {
 				return $cols['CHARACTER_SET_NAME'];
@@ -442,7 +442,7 @@ class Mysql extends DboSource {
 		$old = version_compare($this->getVersion(), '4.1', '<=');
 		if ($table) {
 			$indices = $this->_execute('SHOW INDEX FROM ' . $table);
-			while ($idx = $indices->fetch()) {
+			while ($idx = $indices->fetch(PDO::FETCH_OBJ)) {
 				if ($old) {
 					$idx = (object) current((array)$idx);
 				}