From a50f016991527c419595f81397f3ad67e12bea1c Mon Sep 17 00:00:00 2001 From: webchick Date: Sun, 22 Apr 2012 18:57:18 -0700 Subject: Issue #1237252 by mfb, bfroehle, drewish, Berdir, iamEAP, drumm: Fixed DB Case Sensitivity: Allow BINARY attribute in MySQL. --- includes/database/mysql/schema.inc | 9 +++++++-- includes/database/schema.inc | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'includes/database') diff --git a/includes/database/mysql/schema.inc b/includes/database/mysql/schema.inc index 7268f2d89..d6aea4d94 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 b7ae97015..d3943b29b 100644 --- a/includes/database/schema.inc +++ b/includes/database/schema.inc @@ -76,6 +76,10 @@ 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': A boolean indicating that MySQL should force 'char', + * 'varchar' or 'text' fields to use 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', and type * 'varchar' must specify the 'length' parameter. -- cgit v1.2.3