function DatabaseTestController::dbQueryTemporary
Same name in other branches
- 9 core/modules/system/tests/modules/database_test/src/Controller/DatabaseTestController.php \Drupal\database_test\Controller\DatabaseTestController::dbQueryTemporary()
Creates temporary table and outputs 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.
Return value
\Symfony\Component\HttpFoundation\JsonResponse
1 string reference to 'DatabaseTestController::dbQueryTemporary'
- database_test.routing.yml in core/
modules/ system/ tests/ modules/ database_test/ database_test.routing.yml - core/modules/system/tests/modules/database_test/database_test.routing.yml
File
-
core/
modules/ system/ tests/ modules/ database_test/ src/ Controller/ DatabaseTestController.php, line 50
Class
- DatabaseTestController
- Controller routines for database_test routes.
Namespace
Drupal\database_test\ControllerCode
public function dbQueryTemporary() {
$table_name = $this->connection
->queryTemporary('SELECT age FROM {test}', []);
return new JsonResponse([
'table_name' => $table_name,
'row_count' => $this->connection
->select($table_name)
->countQuery()
->execute()
->fetchField(),
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.