From 951c257b427cae7614f468cc2575a51ef7554b18 Mon Sep 17 00:00:00 2001
From: catch <catch56@gmail.com>
Date: Sun, 23 Oct 2022 09:22:58 +0100
Subject: [PATCH] Issue #3312641 by nkoporec, pradhumanjainOSL, Ratan Priya,
 Anchal_gupta, daffie, mglaman, catch: Bring back temporary tables
 (Connection::queryTemporary())

---
 core/lib/Drupal/Core/Database/Connection.php                 | 5 -----
 core/modules/mysql/src/Driver/Database/mysql/Connection.php  | 1 -
 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php  | 1 -
 .../modules/sqlite/src/Driver/Database/sqlite/Connection.php | 1 -
 .../tests/src/Functional/Database/TemporaryQueryTest.php     | 1 -
 .../tests/Drupal/Tests/Core/Database/Stub/StubConnection.php | 1 -
 .../fixtures/database_drivers/custom/fake/Connection.php     | 1 -
 7 files changed, 11 deletions(-)

diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php
index da910131e11b..8402e6f6eb0f 100644
--- a/core/lib/Drupal/Core/Database/Connection.php
+++ b/core/lib/Drupal/Core/Database/Connection.php
@@ -1816,11 +1816,6 @@ protected function generateTemporaryTableName() {
    *
    * @return string
    *   The name of the temporary table.
-   *
-   * @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no
-   *   replacement.
-   *
-   * @see https://www.drupal.org/node/3211781
    */
   abstract public function queryTemporary($query, array $args = [], array $options = []);
 
diff --git a/core/modules/mysql/src/Driver/Database/mysql/Connection.php b/core/modules/mysql/src/Driver/Database/mysql/Connection.php
index 4fbb2221ee67..1edfdfd1e964 100644
--- a/core/modules/mysql/src/Driver/Database/mysql/Connection.php
+++ b/core/modules/mysql/src/Driver/Database/mysql/Connection.php
@@ -251,7 +251,6 @@ public function queryRange($query, $from, $count, array $args = [], array $optio
    * {@inheritdoc}
    */
   public function queryTemporary($query, array $args = [], array $options = []) {
-    @trigger_error('Connection::queryTemporary() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3211781', E_USER_DEPRECATED);
     $tablename = $this->generateTemporaryTableName();
     $this->query('CREATE TEMPORARY TABLE {' . $tablename . '} Engine=MEMORY ' . $query, $args, $options);
     return $tablename;
diff --git a/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php b/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php
index b36525b337e7..8df056b6fb8a 100644
--- a/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php
+++ b/core/modules/pgsql/src/Driver/Database/pgsql/Connection.php
@@ -218,7 +218,6 @@ public function queryRange($query, $from, $count, array $args = [], array $optio
    * {@inheritdoc}
    */
   public function queryTemporary($query, array $args = [], array $options = []) {
-    @trigger_error('Connection::queryTemporary() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3211781', E_USER_DEPRECATED);
     $tablename = $this->generateTemporaryTableName();
     $this->query('CREATE TEMPORARY TABLE {' . $tablename . '} AS ' . $query, $args, $options);
     return $tablename;
diff --git a/core/modules/sqlite/src/Driver/Database/sqlite/Connection.php b/core/modules/sqlite/src/Driver/Database/sqlite/Connection.php
index 17fd2567d574..d4abe3cab400 100644
--- a/core/modules/sqlite/src/Driver/Database/sqlite/Connection.php
+++ b/core/modules/sqlite/src/Driver/Database/sqlite/Connection.php
@@ -391,7 +391,6 @@ public function queryRange($query, $from, $count, array $args = [], array $optio
    * {@inheritdoc}
    */
   public function queryTemporary($query, array $args = [], array $options = []) {
-    @trigger_error('Connection::queryTemporary() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3211781', E_USER_DEPRECATED);
     // Generate a new temporary table name and protect it from prefixing.
     // SQLite requires that temporary tables to be non-qualified.
     $tablename = $this->generateTemporaryTableName();
diff --git a/core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php b/core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php
index 419363a2cb9f..ce7d55f86833 100644
--- a/core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php
+++ b/core/modules/system/tests/src/Functional/Database/TemporaryQueryTest.php
@@ -33,7 +33,6 @@ public function countTableRows($table_name) {
    * Confirms that temporary tables work and are limited to one request.
    */
   public function testTemporaryQuery() {
-    $this->expectDeprecation('Connection::queryTemporary() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3211781');
     $this->expectDeprecation('Connection::generateTemporaryTableName() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3211781');
 
     $connection = Database::getConnection();
diff --git a/core/tests/Drupal/Tests/Core/Database/Stub/StubConnection.php b/core/tests/Drupal/Tests/Core/Database/Stub/StubConnection.php
index b553dcce0dc5..1f073757914c 100644
--- a/core/tests/Drupal/Tests/Core/Database/Stub/StubConnection.php
+++ b/core/tests/Drupal/Tests/Core/Database/Stub/StubConnection.php
@@ -63,7 +63,6 @@ public function queryRange($query, $from, $count, array $args = [], array $optio
    * {@inheritdoc}
    */
   public function queryTemporary($query, array $args = [], array $options = []) {
-    @trigger_error('Connection::queryTemporary() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3211781', E_USER_DEPRECATED);
     return '';
   }
 
diff --git a/core/tests/fixtures/database_drivers/custom/fake/Connection.php b/core/tests/fixtures/database_drivers/custom/fake/Connection.php
index ec0c9cf2dc90..0d05ad45778b 100644
--- a/core/tests/fixtures/database_drivers/custom/fake/Connection.php
+++ b/core/tests/fixtures/database_drivers/custom/fake/Connection.php
@@ -28,7 +28,6 @@ public function queryRange($query, $from, $count, array $args = [], array $optio
    * {@inheritdoc}
    */
   public function queryTemporary($query, array $args = [], array $options = []) {
-    @trigger_error('Connection::queryTemporary() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3211781', E_USER_DEPRECATED);
     return '';
   }
 
-- 
GitLab