summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--content.module11
2 files changed, 12 insertions, 0 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index b281cb6..a085a5b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -50,6 +50,7 @@ Bugfixes:
- Minor fix in multigroup. Remove unused argument $form_id from invocation to worker functions in hook_form_alter().
- #545942 warning: array_filter() [function.array-filter]: The first argument should be an array in userreference_update_6002().
- #521002 Fix validation errors when using optgroups in allowed values for select elements.
+- #550252 by GuyPaddock - content_db_index_exists produces SQL errors when creating node reference fields for MySQL 4 (related to #231453).
Changes:
- #421116 Move content.js to js/content.admin.js for consistency with location of new js files.
diff --git a/content.module b/content.module
index 6b422c6..70a2cc9 100644
--- a/content.module
+++ b/content.module
@@ -2153,6 +2153,7 @@ function content_table_schema($field = NULL) {
*
* @todo: May we remove this funcion when implemented by Drupal core itself?
* @link http://drupal.org/node/360854
+ * @link http://dev.mysql.com/doc/refman/5.0/en/extended-show.html
*
* @param $table
* Name of the table.
@@ -2164,6 +2165,16 @@ function content_table_schema($field = NULL) {
function content_db_index_exists($table, $name) {
global $db_type;
if ($db_type == 'mysql' || $db_type == 'mysqli') {
+ if (version_compare(db_version(), '5.0.3') < 0) {
+ // Earlier versions of MySQL don't support a WHERE clause for SHOW.
+ $result = db_query('SHOW INDEX FROM {'. $table .'}');
+ while ($row = db_fetch_array($result)) {
+ if ($row['Key_name'] == $name) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+ }
return (bool)db_result(db_query("SHOW INDEX FROM {". $table ."} WHERE key_name = '$name'"));
}
elseif ($db_type == 'pgsql') {