Skip to content
Snippets Groups Projects
Commit 1a25e6f7 authored by James Glasgow's avatar James Glasgow Committed by Joao Ventura
Browse files

Issue #3317852 by adrianopulz, jrglasgow, jcnventura: Uppercase columns errors...

Issue #3317852 by adrianopulz, jrglasgow, jcnventura: Uppercase columns errors on information_schema tables queries
parent a7a1ff57
Branches
Tags
No related merge requests found
......@@ -118,6 +118,26 @@ class SchemaDatabaseSchema_mysql extends DatabaseSchema_mysql implements Databas
return $comment;
}
/**
* Force the query result object columns to lowercase.
*
* @param object $object
* The query result object.
*
* @return object
* A new object with the properties in lowercase.
*/
protected function queryToLowerCase(&$object) {
foreach ($object as $key => $value) {
$lckey = strtolower($key);
if ($lckey !== $key) {
unset($object->{$key});
$object->{$lckey} = $value;
}
}
return $object;
}
public function inspect($connection = NULL, $table_name = NULL) {
// Support the deprecated connection parameter.
if (isset($connection) && $connection != $this->connection->getKey()) {
......@@ -148,6 +168,7 @@ class SchemaDatabaseSchema_mysql extends DatabaseSchema_mysql implements Databas
}
$res = $this->connection->query($sql, $args);
foreach ($res as $r) {
$r = $this->queryToLowerCase($r);
$tables[$r->table_name]['description'] = $r->table_comment;
}
......@@ -162,6 +183,7 @@ class SchemaDatabaseSchema_mysql extends DatabaseSchema_mysql implements Databas
$res = $this->connection->query($sql, $args);
foreach ($res as $r) {
$r = $this->queryToLowerCase($r);
$r->new_table_name = schema_unprefix_table($r->table_name, $this->connection);
$numeric = !is_null($r->numeric_scale);
......@@ -220,6 +242,7 @@ class SchemaDatabaseSchema_mysql extends DatabaseSchema_mysql implements Databas
$res = $this->connection->query($sql, $args);
foreach ($res as $r) {
$r = $this->queryToLowerCase($r);
if (isset($r->sub_part) && !is_null($r->sub_part)) {
$col = [$r->column_name, intval($r->sub_part)];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment