Aaron Schulz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/351120 )

Change subject: Make registerTempTableOperation() more robust
......................................................................

Make registerTempTableOperation() more robust

Detect TRUNCATE operations and clean up return value

Change-Id: I6094624fc594b23b1df6107f7ac1c3d93f609ebc
---
M includes/libs/rdbms/database/Database.php
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/20/351120/1

diff --git a/includes/libs/rdbms/database/Database.php 
b/includes/libs/rdbms/database/Database.php
index 88a883a..ac72350 100644
--- a/includes/libs/rdbms/database/Database.php
+++ b/includes/libs/rdbms/database/Database.php
@@ -817,7 +817,7 @@
 
        /**
         * @param string $sql A SQL query
-        * @return bool Whether $sql is SQL for creating/dropping a new 
TEMPORARY table
+        * @return bool Whether $sql is SQL for TEMPORARY table operation
         */
        protected function registerTempTableOperation( $sql ) {
                if ( preg_match(
@@ -833,9 +833,16 @@
                        $sql,
                        $matches
                ) ) {
+                       $isTemp = isset( $this->mSessionTempTables[$matches[1]] 
);
                        unset( $this->mSessionTempTables[$matches[1]] );
 
-                       return true;
+                       return $isTemp;
+               } elseif ( preg_match(
+                       
'/^TRUNCATE\s+(?:TEMPORARY\s+)?TABLE\s+(?:IF\s+EXISTS\s+)?[`"\']?(\w+)[`"\']?/i',
+                       $sql,
+                       $matches
+               ) ) {
+                       return isset( $this->mSessionTempTables[$matches[1]] );
                } elseif ( preg_match(
                        
'/^(?:INSERT\s+(?:\w+\s+)?INTO|UPDATE|DELETE\s+FROM)\s+[`"\']?(\w+)[`"\']?/i',
                        $sql,

-- 
To view, visit https://gerrit.wikimedia.org/r/351120
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6094624fc594b23b1df6107f7ac1c3d93f609ebc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to