Commit 8f69e2d3 authored by runa's avatar runa

Sometimes mysql return keys with first letter in uppercase

parent 7e8f168d
...@@ -271,6 +271,9 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict { ...@@ -271,6 +271,9 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict {
* @return array * @return array
*/ */
public function listDatabases() { 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 { ...@@ -318,7 +321,11 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict {
$sql = "DESCRIBE $table"; $sql = "DESCRIBE $table";
$result = $this->dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC); $result = $this->dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC);
$description = array(); $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( $description = array(
'name' => $val['field'], 'name' => $val['field'],
'type' => $val['type'], 'type' => $val['type'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment