diff --git a/src/Dibi/Reflection/Result.php b/src/Dibi/Reflection/Result.php index 729bf4b4..9fa06709 100644 --- a/src/Dibi/Reflection/Result.php +++ b/src/Dibi/Reflection/Result.php @@ -98,7 +98,7 @@ class Result $this->columns = []; $reflector = $this->driver instanceof Dibi\Reflector ? $this->driver : NULL; foreach ($this->driver->getResultColumns() as $info) { - $this->columns[] = $this->names[$info['name']] = new Column($reflector, $info); + $this->columns[] = $this->names[strtolower($info['name'])] = new Column($reflector, $info); } } } diff --git a/tests/dibi/Result.meta.phpt b/tests/dibi/Result.meta.phpt index 425dea61..1731cd6d 100644 --- a/tests/dibi/Result.meta.phpt +++ b/tests/dibi/Result.meta.phpt @@ -16,7 +16,7 @@ $conn = new Dibi\Connection($config); $conn->loadFile(__DIR__ . "/data/$config[system].sql"); $info = $conn->query(' - SELECT products.product_id, orders.order_id, customers.name, products.product_id + 1 AS xxx + SELECT products.product_id, orders.order_id, customers.name, products.product_id + 1 AS [xXx] FROM products INNER JOIN orders USING (product_id) INNER JOIN customers USING (customer_id) @@ -24,14 +24,14 @@ $info = $conn->query(' Assert::same( - ['product_id', 'order_id', 'name', 'xxx'], + ['product_id', 'order_id', 'name', 'xXx'], $info->getColumnNames() ); if ($config['driver'] !== 'sqlite3' && $config['driver'] !== 'pdo') { Assert::same( - ['products.product_id', 'orders.order_id', 'customers.name', 'xxx'], + ['products.product_id', 'orders.order_id', 'customers.name', 'xXx'], $info->getColumnNames(TRUE) ); } @@ -49,9 +49,12 @@ if ($config['system'] !== 'sqlite') { } Assert::null($columns[0]->isNullable()); -Assert::same('xxx', $columns[3]->getName()); +Assert::same('xXx', $columns[3]->getName()); Assert::null($columns[3]->getTableName()); if ($config['system'] !== 'sqlite') { Assert::same('i', $columns[0]->getType()); } Assert::null($columns[3]->isNullable()); + +Assert::same('xXx', $info->getColumn('xxx')->getName()); +Assert::same('xXx', $info->getColumn('xXx')->getName());