From 8f69e2d3ea02312c927ba5e278bc714d118cb190 Mon Sep 17 00:00:00 2001 From: runa Date: Mon, 30 Oct 2006 20:53:25 +0000 Subject: [PATCH] Sometimes mysql return keys with first letter in uppercase --- lib/Doctrine/DataDict/Mysql.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/DataDict/Mysql.php b/lib/Doctrine/DataDict/Mysql.php index e904aa2af..8459fefd5 100644 --- a/lib/Doctrine/DataDict/Mysql.php +++ b/lib/Doctrine/DataDict/Mysql.php @@ -271,6 +271,9 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict { * @return array */ public function listDatabases() { + $sql = 'SHOW DATABASES'; + + return $this->dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC); } /** @@ -318,7 +321,11 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict { $sql = "DESCRIBE $table"; $result = $this->dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC); $description = array(); - foreach ($result as $key => $val) { + foreach ($result as $key => $val2) { + $val = array(); + foreach(array_keys($val2) as $valKey){ // lowercase the key names + $val[strtolower($valKey)] = $val2[$valKey]; + } $description = array( 'name' => $val['field'], 'type' => $val['type'],