All the databases but MySQL were overriding DatabaseBase::deleteJoin() with the same...
[lhc/web/wiklou.git] / includes / db / DatabaseMysql.php
index 759d1ac..2dc3b73 100644 (file)
@@ -482,6 +482,25 @@ class DatabaseMysql extends DatabaseBase {
                $this->query( "SET sql_big_selects=$encValue", __METHOD__ );
        }
 
+       /**
+        * DELETE where the condition is a join. MySql uses multi-table deletes.
+        */
+       function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = 'DatabaseBase::deleteJoin' ) {
+               if ( !$conds ) {
+                       throw new DBUnexpectedError( $this, 'DatabaseBase::deleteJoin() called with empty $conds' );
+               }
+
+               $delTable = $this->tableName( $delTable );
+               $joinTable = $this->tableName( $joinTable );
+               $sql = "DELETE $delTable FROM $delTable, $joinTable WHERE $delVar=$joinVar ";
+
+               if ( $conds != '*' ) {
+                       $sql .= ' AND ' . $this->makeList( $conds, LIST_AND );
+               }
+
+               return $this->query( $sql, $fname );
+       }
+
        /**
         * Determines if the last failure was due to a deadlock
         */