summaryrefslogtreecommitdiff
path: root/includes/database
diff options
context:
space:
mode:
Diffstat (limited to 'includes/database')
-rw-r--r--includes/database/database.inc3
-rw-r--r--includes/database/mysql/database.inc2
-rw-r--r--includes/database/mysql/schema.inc11
-rw-r--r--includes/database/pgsql/database.inc2
-rw-r--r--includes/database/pgsql/schema.inc4
-rw-r--r--includes/database/query.inc2
-rw-r--r--includes/database/schema.inc7
-rw-r--r--includes/database/sqlite/database.inc8
8 files changed, 20 insertions, 19 deletions
diff --git a/includes/database/database.inc b/includes/database/database.inc
index 6e40b2765..6efe298d2 100644
--- a/includes/database/database.inc
+++ b/includes/database/database.inc
@@ -1430,9 +1430,6 @@ abstract class Database {
/**
* Gets the connection object for the specified database key and target.
*
- * Note: do not use the setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE) on the
- * returned object because of http://bugs.php.net/bug.php?id=43139.
- *
* @param $target
* The database target name.
* @param $key
diff --git a/includes/database/mysql/database.inc b/includes/database/mysql/database.inc
index e024a7f39..7278a2bc8 100644
--- a/includes/database/mysql/database.inc
+++ b/includes/database/mysql/database.inc
@@ -46,8 +46,6 @@ class DatabaseConnection_mysql extends DatabaseConnection {
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,
);
parent::__construct($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']);
diff --git a/includes/database/mysql/schema.inc b/includes/database/mysql/schema.inc
index 4e88fa169..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'] . ')';
@@ -381,7 +386,7 @@ class DatabaseSchema_mysql extends DatabaseSchema {
// Returns one row for each column in the index. Result is string or FALSE.
// Details at http://dev.mysql.com/doc/refman/5.0/en/show-index.html
$row = $this->connection->query('SHOW INDEX FROM {' . $table . "} WHERE key_name = '$name'")->fetchAssoc();
- return isset($row['key_name']);
+ return isset($row['Key_name']);
}
public function addPrimaryKey($table, $fields) {
diff --git a/includes/database/pgsql/database.inc b/includes/database/pgsql/database.inc
index d42a1cc3c..d80b47551 100644
--- a/includes/database/pgsql/database.inc
+++ b/includes/database/pgsql/database.inc
@@ -62,8 +62,6 @@ class DatabaseConnection_pgsql extends DatabaseConnection {
PDO::ATTR_EMULATE_PREPARES => TRUE,
// Convert numeric values to strings when fetching.
PDO::ATTR_STRINGIFY_FETCHES => TRUE,
- // Force column names to lower case.
- PDO::ATTR_CASE => PDO::CASE_LOWER,
);
parent::__construct($dsn, $connection_options['username'], $connection_options['password'], $connection_options['pdo']);
diff --git a/includes/database/pgsql/schema.inc b/includes/database/pgsql/schema.inc
index 9ed8a2620..49adbf907 100644
--- a/includes/database/pgsql/schema.inc
+++ b/includes/database/pgsql/schema.inc
@@ -328,9 +328,9 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
// rename them when renaming the table.
$indexes = $this->connection->query('SELECT indexname FROM pg_indexes WHERE schemaname = :schema AND tablename = :table', array(':schema' => $old_schema, ':table' => $old_table_name));
foreach ($indexes as $index) {
- if (preg_match('/^' . preg_quote($old_full_name) . '_(.*)_idx$/', $index->indexname, $matches)) {
+ if (preg_match('/^' . preg_quote($old_full_name) . '_(.*)$/', $index->indexname, $matches)) {
$index_name = $matches[1];
- $this->connection->query('ALTER INDEX ' . $index->indexname . ' RENAME TO {' . $new_name . '}_' . $index_name . '_idx');
+ $this->connection->query('ALTER INDEX ' . $index->indexname . ' RENAME TO {' . $new_name . '}_' . $index_name);
}
}
diff --git a/includes/database/query.inc b/includes/database/query.inc
index 6020b0ea5..750aea7a0 100644
--- a/includes/database/query.inc
+++ b/includes/database/query.inc
@@ -1898,7 +1898,7 @@ class DatabaseCondition implements QueryConditionInterface, Countable {
function __clone() {
$this->changed = TRUE;
foreach ($this->conditions as $key => $condition) {
- if ($condition['field'] instanceOf QueryConditionInterface) {
+ if ($key !== '#conjunction' && $condition['field'] instanceOf QueryConditionInterface) {
$this->conditions[$key]['field'] = clone($condition['field']);
}
}
diff --git a/includes/database/schema.inc b/includes/database/schema.inc
index e2a1c4caa..d3943b29b 100644
--- a/includes/database/schema.inc
+++ b/includes/database/schema.inc
@@ -76,8 +76,13 @@ 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'.
+ * 'numeric' columns must specify 'precision' and 'scale', and type
+ * 'varchar' must specify the 'length' parameter.
* - 'primary key': An array of one or more key column specifiers (see below)
* that form the primary key.
* - 'unique keys': An associative array of unique keys ('keyname' =>
diff --git a/includes/database/sqlite/database.inc b/includes/database/sqlite/database.inc
index b4e41b527..ea91e9143 100644
--- a/includes/database/sqlite/database.inc
+++ b/includes/database/sqlite/database.inc
@@ -37,7 +37,7 @@ class DatabaseConnection_sqlite extends DatabaseConnection {
/**
* All databases attached to the current database. This is used to allow
* prefixes to be safely handled without locking the table
- *
+ *
* @var array
*/
protected $attachedDatabases = array();
@@ -46,10 +46,10 @@ class DatabaseConnection_sqlite extends DatabaseConnection {
* Whether or not a table has been dropped this request: the destructor will
* only try to get rid of unnecessary databases if there is potential of them
* being empty.
- *
+ *
* This variable is set to public because DatabaseSchema_sqlite needs to
* access it. However, it should not be manually set.
- *
+ *
* @var boolean
*/
var $tableDropped = FALSE;
@@ -68,8 +68,6 @@ class DatabaseConnection_sqlite extends DatabaseConnection {
'pdo' => array(),
);
$connection_options['pdo'] += array(
- // Force column names to lower case.
- PDO::ATTR_CASE => PDO::CASE_LOWER,
// Convert numeric values to strings when fetching.
PDO::ATTR_STRINGIFY_FETCHES => TRUE,
);