interface SupportsTemporaryTablesInterface

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Database/SupportsTemporaryTablesInterface.php \Drupal\Core\Database\SupportsTemporaryTablesInterface

Adds support for temporary tables.

Hierarchy

Expanded class hierarchy of SupportsTemporaryTablesInterface

All classes that implement SupportsTemporaryTablesInterface

Related topics

3 files declare their use of SupportsTemporaryTablesInterface
Connection.php in core/modules/sqlite/src/Driver/Database/sqlite/Connection.php
Connection.php in core/modules/mysql/src/Driver/Database/mysql/Connection.php
Connection.php in core/modules/pgsql/src/Driver/Database/pgsql/Connection.php

File

core/lib/Drupal/Core/Database/SupportsTemporaryTablesInterface.php, line 10

Namespace

Drupal\Core\Database
View source
interface SupportsTemporaryTablesInterface {
    
    /**
     * Runs a SELECT query and stores its results in a temporary table.
     *
     * Use this as a substitute for ->query() when the results need to stored
     * in a temporary table. Temporary tables exist for the duration of the page
     * request. User-supplied arguments to the query should be passed in as
     * separate parameters so that they can be properly escaped to avoid SQL
     * injection attacks.
     *
     * Note that if you need to know how many results were returned, you should do
     * a SELECT COUNT(*) on the temporary table afterwards.
     *
     * @param string $query
     *   A string containing a normal SELECT SQL query.
     * @param array $args
     *   (optional) An array of values to substitute into the query at placeholder
     *   markers.
     * @param array $options
     *   (optional) An associative array of options to control how the query is
     *   run. See the documentation for DatabaseConnection::defaultOptions() for
     *   details.
     *
     * @return string
     *   The name of the temporary table.
     */
    public function queryTemporary($query, array $args = [], array $options = []);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
SupportsTemporaryTablesInterface::queryTemporary public function Runs a SELECT query and stores its results in a temporary table. 3

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.