SupportsTemporaryTablesInterface.php

Same filename and directory in other branches
  1. 10 core/lib/Drupal/Core/Database/SupportsTemporaryTablesInterface.php

Namespace

Drupal\Core\Database

File

core/lib/Drupal/Core/Database/SupportsTemporaryTablesInterface.php

View source
<?php

namespace Drupal\Core\Database;


/**
 * Adds support for temporary tables.
 *
 * @ingroup database
 */
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 = []);

}

Interfaces

Title Deprecated Summary
SupportsTemporaryTablesInterface Adds support for temporary tables.

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