- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
if (!$left || !$right) return true;
$sql = "DELETE FROM {$this->_tableName} WHERE `user_id`=$user_id";
$this->_db->exec($sql);
if (!$this->_isTriggers) {
if (($right - $left) == 1) {
$sql = "UPDATE {$this->_tableName} SET `left`=IF(`left` >= $left,`left`-2,`left`),`right`=`right`-2 WHERE `right` >= $left";
} else {
$sql = "UPDATE {$this->_tableName} SET
`left`=IF(`left` BETWEEN $left AND $right,`left`-1,`left`),
`right`=IF(`right` BETWEEN $left AND $right,`right`-1,`right`),
`level`=IF(`left` BETWEEN $left AND $right,`level`-1,`level`),
`left`=IF(`left`>$right,`left`-2,`left`),
`right`=IF(`right`>$right,`right`-2,`right`)
WHERE `right` > $left
";
}
$this->_db->exec($sql);
Только ручной сбор запроса. Zend Db