From ae5328cd9050b72c052bb33daf14f7e04e3cd5b7 Mon Sep 17 00:00:00 2001 From: Bradley M. Froehle Date: Sun, 10 Apr 2011 15:49:40 -0700 Subject: [PATCH] - Patch #966210 by mfb, bfroehle: Fixed DB Case Sensitivity. --- includes/database/mysql/schema.inc | 9 +++++++-- includes/database/schema.inc | 3 +++ modules/system/system.install | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/includes/database/mysql/schema.inc b/includes/database/mysql/schema.inc index 4e88fa1..d0f4259 100644 --- a/includes/database/mysql/schema.inc +++ b/includes/database/mysql/schema.inc @@ -131,8 +131,13 @@ class DatabaseSchema_mysql extends DatabaseSchema { protected function createFieldSql($name, $spec) { $sql = "`" . $name . "` " . $spec['mysql_type']; - if (in_array($spec['mysql_type'], array('VARCHAR', 'CHAR', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', 'TEXT')) && isset($spec['length'])) { - $sql .= '(' . $spec['length'] . ')'; + if (in_array($spec['mysql_type'], array('VARCHAR', 'CHAR', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', 'TEXT'))) { + if (isset($spec['length'])) { + $sql .= '(' . $spec['length'] . ')'; + } + if (!empty($spec['binary'])) { + $sql .= ' BINARY'; + } } elseif (isset($spec['precision']) && isset($spec['scale'])) { $sql .= '(' . $spec['precision'] . ', ' . $spec['scale'] . ')'; diff --git a/includes/database/schema.inc b/includes/database/schema.inc index de1b2f5..69c19c5 100644 --- a/includes/database/schema.inc +++ b/includes/database/schema.inc @@ -76,6 +76,9 @@ require_once dirname(__FILE__) . '/query.inc'; * the precision (total number of significant digits) and scale * (decimal digits right of the decimal point). Both values are * mandatory. Ignored for other field types. + * - 'binary': For type 'char', 'varchar' or 'text' fields on MySQL, forces + * a case-sensitive binary collation. This has no effect on other database + * types for which case sensitivity is already the default behavior. * All parameters apart from 'type' are optional except that type * 'numeric' columns must specify 'precision' and 'scale'. * - 'primary key': An array of one or more key column specifiers (see below) diff --git a/modules/system/system.install b/modules/system/system.install index c89ce4f..d861b3f 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -817,6 +817,7 @@ function system_schema() { 'length' => 255, 'not null' => TRUE, 'default' => '', + 'binary' => TRUE, ), 'filemime' => array( 'description' => "The file's MIME type.", -- 1.7.3.5