You are here

protected function ConnectionUnitTest::getQuery in Drupal 9

Returns a set of queries specific for the database in testing.

File

core/tests/Drupal/KernelTests/Core/Database/ConnectionUnitTest.php, line 53

Class

ConnectionUnitTest
Tests management of database connections.

Namespace

Drupal\KernelTests\Core\Database

Code

protected function getQuery() {
  if ($this->connection
    ->databaseType() == 'pgsql') {
    return [
      'connection_id' => 'SELECT pg_backend_pid()',
      'processlist' => 'SELECT pid FROM pg_stat_activity',
      'show_tables' => 'SELECT * FROM pg_catalog.pg_tables',
    ];
  }
  else {
    return [
      'connection_id' => 'SELECT CONNECTION_ID()',
      'processlist' => 'SHOW PROCESSLIST',
      'show_tables' => 'SHOW TABLES',
    ];
  }
}