Skip to content

Commit 09f36df

Browse files
committed
Support join in delete()
1 parent e4b060d commit 09f36df

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

MysqliDb.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,11 @@ public function delete($tableName, $numRows = null)
607607
if ($this->isSubQuery)
608608
return;
609609

610-
$this->_query = "DELETE FROM " . self::$prefix . $tableName;
610+
$table = self::$prefix . $tableName;
611+
if (count ($this->_join))
612+
$this->_query = "DELETE " . preg_replace ('/.* (.*)/', '$1', $table) . " FROM " . $table;
613+
else
614+
$this->_query = "DELETE FROM " . $table;
611615

612616
$stmt = $this->_buildQuery($numRows);
613617
$stmt->execute();

0 commit comments

Comments
 (0)