database_test_db_query_temporary

Versions
7
database_test_db_query_temporary()

Run a db_query_temporary and output the table name and its number of rows.

We need to test that the table created is temporary, so we run it here, in a separate menu callback request; After this request is done, the temporary table should automatically dropped.

Code

modules/simpletest/tests/database_test.module, line 77

<?php
function database_test_db_query_temporary() {
  $table_name = db_query_temporary('SELECT status FROM {system}', array());
  drupal_json_output(array(
    'table_name' => $table_name,
    'row_count' => db_select($table_name)->countQuery()->execute()->fetchField(),
  ));
  exit;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.