From d32a4c9dc4965aeae49211faa7cae7b6e0b7e7af Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Fri, 28 Nov 2008 09:27:58 +0000
Subject: [PATCH] - Patch #337926 by hswong3i: by default, force lower-case
 database tables/columns.

---
 includes/database/mysql/database.inc  | 2 ++
 includes/database/pgsql/database.inc  | 2 ++
 includes/database/sqlite/database.inc | 5 ++++-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/includes/database/mysql/database.inc b/includes/database/mysql/database.inc
index 60191db0a59f..23470abc3e23 100644
--- a/includes/database/mysql/database.inc
+++ b/includes/database/mysql/database.inc
@@ -29,6 +29,8 @@ public function __construct(Array $connection_options = array()) {
       PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => TRUE,
       // Because MySQL's prepared statements skip the query cache, because it's dumb.
       PDO::ATTR_EMULATE_PREPARES => TRUE,
+      // Force column names to lower case.
+      PDO::ATTR_CASE => PDO::CASE_LOWER,
     ));
 
     // Force MySQL to use the UTF-8 character set by default.
diff --git a/includes/database/pgsql/database.inc b/includes/database/pgsql/database.inc
index 6393eaebebda..04e403222751 100644
--- a/includes/database/pgsql/database.inc
+++ b/includes/database/pgsql/database.inc
@@ -30,6 +30,8 @@ public function __construct(Array $connection_options = array()) {
     parent::__construct($dsn, $connection_options['username'], $connection_options['password'], array(
       // Convert numeric values to strings when fetching.
       PDO::ATTR_STRINGIFY_FETCHES => TRUE,
+      // Force column names to lower case.
+      PDO::ATTR_CASE => PDO::CASE_LOWER,
     ));
   }
 
diff --git a/includes/database/sqlite/database.inc b/includes/database/sqlite/database.inc
index 769653f59792..7f3d521cfa14 100644
--- a/includes/database/sqlite/database.inc
+++ b/includes/database/sqlite/database.inc
@@ -31,7 +31,10 @@ public function __construct(Array $connection_options = array()) {
 
     $this->transactionSupport = isset($connection_options['transactions']) ? $connection_options['transactions'] : TRUE;
 
-    parent::__construct('sqlite:'. $connection_options['database'], '', '', $connection_options);
+    parent::__construct('sqlite:'. $connection_options['database'], '', '', array(
+      // Force column names to lower case.
+      PDO::ATTR_CASE => PDO::CASE_LOWER,
+    ));
 
     $this->exec('PRAGMA encoding="UTF-8"');
 
-- 
GitLab