diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-03-01 11:30:37 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-03-01 11:30:37 +0000 |
commit | 13704b8f628af43c5bd1c404cb4eb2ef4d550401 (patch) | |
tree | 0108353e4b66e5791fcd9c5c874a4da5a916209a /includes/database/mysql | |
parent | 74e94b7e019d29bb58928df0b5b5de8ec3651359 (diff) | |
download | brdo-13704b8f628af43c5bd1c404cb4eb2ef4d550401.tar.gz brdo-13704b8f628af43c5bd1c404cb4eb2ef4d550401.tar.bz2 |
- Patch #722912 by andypost: db_index_exists() must conform schemaAPI indexExists().
Diffstat (limited to 'includes/database/mysql')
-rw-r--r-- | includes/database/mysql/schema.inc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/includes/database/mysql/schema.inc b/includes/database/mysql/schema.inc index 69500d3fa..ee2b3d373 100644 --- a/includes/database/mysql/schema.inc +++ b/includes/database/mysql/schema.inc @@ -348,7 +348,10 @@ class DatabaseSchema_mysql extends DatabaseSchema { } public function indexExists($table, $name) { - return $this->connection->query('SHOW INDEX FROM {' . $table . "} WHERE key_name = '$name'")->fetchField(); + // 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']); } public function addPrimaryKey($table, $fields) { |