| 7 database_test.test | DatabaseUpdateComplexTestCase::testNotInConditionUpdate() |
| 8 database.test | DatabaseUpdateComplexTestCase::testNotInConditionUpdate() |
Test WHERE NOT IN clauses.
File
- modules/
simpletest/ tests/ database_test.test, line 861
Code
function testNotInConditionUpdate() {
// The o is lowercase in the 'NoT IN' operator, to make sure the operators
// work in mixed case.
$num_updated = db_update('test')
->fields(array('job' => 'Musician'))
->condition('name', array('John', 'Paul', 'George'), 'NoT IN')
->execute();
$this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
$this->assertIdentical($num_matches, '1', t('Updated fields successfully.'));
}
Login or register to post comments