function DatabaseRangeQueryTestCase::testRangeQuery
Confirm that range query work and return correct result.
File
-
modules/
simpletest/ tests/ database_test.test, line 3307
Class
- DatabaseRangeQueryTestCase
- Range query tests.
Code
function testRangeQuery() {
// Test if return correct number of rows.
$range_rows = db_query_range("SELECT name FROM {system} ORDER BY name", 2, 3)->fetchAll();
$this->assertEqual(count($range_rows), 3, 'Range query work and return correct number of rows.');
// Test if return target data.
$raw_rows = db_query('SELECT name FROM {system} ORDER BY name')->fetchAll();
$raw_rows = array_slice($raw_rows, 2, 3);
$this->assertEqual($range_rows, $raw_rows, 'Range query work and return target data.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.