diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2011-09-27 12:06:35 -0700 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2011-09-27 12:06:35 -0700 |
commit | 5dedc4c400ec71e46a9ea641dd18c914b11c1096 (patch) | |
tree | da71658e100676d8d144db9a2c1045c10e5ebe03 /includes | |
parent | 3eb1c0f675a8930678172fc867e94582189aad26 (diff) | |
download | brdo-5dedc4c400ec71e46a9ea641dd18c914b11c1096.tar.gz brdo-5dedc4c400ec71e46a9ea641dd18c914b11c1096.tar.bz2 |
Issue #1226796 by sun, catch, Damien Tournoud: Fixed Not equal operator '!=' is not supported by all databases, must be '<>'.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/entity.inc | 21 | ||||
-rw-r--r-- | includes/update.inc | 2 |
2 files changed, 19 insertions, 4 deletions
diff --git a/includes/entity.inc b/includes/entity.inc index 8ea83a88e..45d697c80 100644 --- a/includes/entity.inc +++ b/includes/entity.inc @@ -606,7 +606,7 @@ class EntityFieldQuery { * dependent on $operator. * @param $operator * Possible values: - * - '=', '!=', '>', '>=', '<', '<=', 'STARTS_WITH', 'CONTAINS': These + * - '=', '<>', '>', '>=', '<', '<=', 'STARTS_WITH', 'CONTAINS': These * operators expect $value to be a literal of the same type as the * column. * - 'IN', 'NOT IN': These operators expect $value to be an array of @@ -620,6 +620,11 @@ class EntityFieldQuery { * The called object. */ public function entityCondition($name, $value, $operator = NULL) { + // The '!=' operator is deprecated in favour of the '<>' operator since the + // latter is ANSI SQL compatible. + if ($operator == '!=') { + $operator = '<>'; + } $this->entityConditions[$name] = array( 'value' => $value, 'operator' => $operator, @@ -724,7 +729,7 @@ class EntityFieldQuery { * element in the array is dependent on $operator. * @param $operator * Possible values: - * - '=', '!=', '>', '>=', '<', '<=', 'STARTS_WITH', 'CONTAINS': These + * - '=', '<>', '>', '>=', '<', '<=', 'STARTS_WITH', 'CONTAINS': These * operators expect $value to be a literal of the same type as the * column. * - 'IN', 'NOT IN': These operators expect $value to be an array of @@ -751,6 +756,11 @@ class EntityFieldQuery { * The called object. */ protected function addFieldCondition(&$conditions, $field, $column = NULL, $value = NULL, $operator = NULL, $delta_group = NULL, $language_group = NULL) { + // The '!=' operator is deprecated in favour of the '<>' operator since the + // latter is ANSI SQL compatible. + if ($operator == '!=') { + $operator = '<>'; + } if (is_scalar($field)) { $field_definition = field_info_field($field); if (empty($field_definition)) { @@ -791,7 +801,7 @@ class EntityFieldQuery { * array is dependent on $operator. * @param $operator * Possible values: - * - '=', '!=', '>', '>=', '<', '<=', 'STARTS_WITH', 'CONTAINS': These + * - '=', '<>', '>', '>=', '<', '<=', 'STARTS_WITH', 'CONTAINS': These * operators expect $value to be a literal of the same type as the * column. * - 'IN', 'NOT IN': These operators expect $value to be an array of @@ -805,6 +815,11 @@ class EntityFieldQuery { * The called object. */ public function propertyCondition($column, $value, $operator = NULL) { + // The '!=' operator is deprecated in favour of the '<>' operator since the + // latter is ANSI SQL compatible. + if ($operator == '!=') { + $operator = '<>'; + } $this->propertyConditions[] = array( 'column' => $column, 'value' => $value, diff --git a/includes/update.inc b/includes/update.inc index 35be17ab2..3a131083d 100644 --- a/includes/update.inc +++ b/includes/update.inc @@ -1426,7 +1426,7 @@ function update_retrieve_dependencies() { $return = array(); // Get a list of installed modules, arranged so that we invoke their hooks in // the same order that module_invoke_all() does. - $modules = db_query("SELECT name FROM {system} WHERE type = 'module' AND schema_version != :schema ORDER BY weight ASC, name ASC", array(':schema' => SCHEMA_UNINSTALLED))->fetchCol(); + $modules = db_query("SELECT name FROM {system} WHERE type = 'module' AND schema_version <> :schema ORDER BY weight ASC, name ASC", array(':schema' => SCHEMA_UNINSTALLED))->fetchCol(); foreach ($modules as $module) { $function = $module . '_update_dependencies'; if (function_exists($function)) { |