function DatabaseQueryTestCase::testArraySubstitution
Test that we can specify an array of values in the query by simply passing in an array.
File
-
modules/
simpletest/ tests/ database_test.test, line 3604
Class
- DatabaseQueryTestCase
- Drupal-specific SQL syntax tests.
Code
function testArraySubstitution() {
$names = db_query('SELECT name FROM {test} WHERE age IN (:ages) ORDER BY age', array(
':ages' => array(
25,
26,
27,
),
))->fetchAll();
$this->assertEqual(count($names), 3, 'Correct number of names returned');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.