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

This commit is contained in:
Jose Lorenzo Rodriguez 2012-01-07 17:53:28 -04:30
parent fa99b58622
commit e5c312f4b5

View file

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