Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Connection.php

function Connection::queryTemporary

Same name in this branch
  1. 11.1.x core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::queryTemporary()
  2. 11.1.x core/modules/mysql/src/Driver/Database/mysql/Connection.php \Drupal\mysql\Driver\Database\mysql\Connection::queryTemporary()

Overrides SupportsTemporaryTablesInterface::queryTemporary

File

core/modules/sqlite/src/Driver/Database/sqlite/Connection.php, line 357

Class

Connection
SQLite implementation of \Drupal\Core\Database\Connection.

Namespace

Drupal\sqlite\Driver\Database\sqlite

Code

public function queryTemporary($query, array $args = [], array $options = []) {
    $tablename = 'db_temporary_' . uniqid();
    $this->query('CREATE TEMPORARY TABLE ' . $tablename . ' AS ' . $query, $args, $options);
    // Temporary tables always live in the temp database, which means that
    // they cannot be fully qualified table names since they do not live
    // in the main SQLite database. We provide the fully-qualified name
    // ourselves to prevent Drupal from applying prefixes.
    // @see https://www.sqlite.org/lang_createtable.html
    return 'temp.' . $tablename;
}
RSS feed
Powered by Drupal