function database_test_even_pager_query

7.x database_test.module database_test_even_pager_query($limit)

Run a pager query and return the results.

This function does care about the page GET parameter, as set by the simpletest HTTP call.

1 string reference to 'database_test_even_pager_query'
database_test_menu in drupal-7.x/modules/simpletest/tests/database_test.module
Implements hook_menu().

File

drupal-7.x/modules/simpletest/tests/database_test.module, line 98

Code

function database_test_even_pager_query($limit) {

  $query = db_select('test', 't');
  $query
  ->fields('t', array('name'))
    ->orderBy('age');

  // This should result in 2 pages of results.
  $query = $query->extend('PagerDefault')->limit($limit);

  $names = $query->execute()->fetchCol();

  drupal_json_output(array(
    'names' => $names,
  ));
  exit;
}