diff options
author | Dries <dries@buytaert.net> | 2011-12-19 09:41:16 -0500 |
---|---|---|
committer | Dries <dries@buytaert.net> | 2011-12-19 09:41:16 -0500 |
commit | ba3e11f132e3e467408e6929342f1df0b0105f7a (patch) | |
tree | b7ac8c71fe349cb9f0e036686088cdfb29096777 | |
parent | ee6826fc164a012bf2d3f14de69e4f48c849647c (diff) | |
parent | 9e12767c75191b440086a6a54f1d470a1b550332 (diff) | |
download | brdo-ba3e11f132e3e467408e6929342f1df0b0105f7a.tar.gz brdo-ba3e11f132e3e467408e6929342f1df0b0105f7a.tar.bz2 |
Merge branch '7.x' of git.drupal.org:project/drupal into 7.x
-rw-r--r-- | includes/database/query.inc | 5 | ||||
-rw-r--r-- | modules/simpletest/tests/database_test.test | 18 |
2 files changed, 6 insertions, 17 deletions
diff --git a/includes/database/query.inc b/includes/database/query.inc index 9cdd8784e..c77968767 100644 --- a/includes/database/query.inc +++ b/includes/database/query.inc @@ -1704,6 +1704,9 @@ class DatabaseCondition implements QueryConditionInterface, Countable { if (is_array($value)) { $operator = 'IN'; } + elseif (!isset($value)) { + $operator = 'IS NULL'; + } else { $operator = '='; } @@ -1737,7 +1740,7 @@ class DatabaseCondition implements QueryConditionInterface, Countable { * Implements QueryConditionInterface::isNull(). */ public function isNull($field) { - return $this->condition($field, NULL, 'IS NULL'); + return $this->condition($field); } /** diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test index 91a51f361..87d386aa7 100644 --- a/modules/simpletest/tests/database_test.test +++ b/modules/simpletest/tests/database_test.test @@ -1454,23 +1454,9 @@ class DatabaseSelectTestCase extends DatabaseTestCase { } /** - * Test that a comparison with NULL is always FALSE. - */ - function testNullCondition() { - $this->ensureSampleDataNull(); - - $names = db_select('test_null', 'tn') - ->fields('tn', array('name')) - ->condition('age', NULL) - ->execute()->fetchCol(); - - $this->assertEqual(count($names), 0, t('No records found when comparing to NULL.')); - } - - /** * Test that we can find a record with a NULL value. */ - function testIsNullCondition() { + function testNullCondition() { $this->ensureSampleDataNull(); $names = db_select('test_null', 'tn') @@ -1485,7 +1471,7 @@ class DatabaseSelectTestCase extends DatabaseTestCase { /** * Test that we can find a record without a NULL value. */ - function testIsNotNullCondition() { + function testNotNullCondition() { $this->ensureSampleDataNull(); $names = db_select('test_null', 'tn') |