/** * delete the records that match $where_criteria in $table * * @param MingoTable $table * @param MingoCriteria $where_criteria * @param boolean $force if true, then empty where criterias can run (deleting all rows from the table) * @return boolean */ public function kill(MingoTable $table, MingoCriteria $where_criteria, $force = false) { // canary... $this->assure($table); if (!$where_criteria->hasWhere() && empty($force)) { throw new UnexpectedValueException('aborting delete because $where_criteria had no where clause'); } //if $ret_bool = false; $where_criteria->killSort(); // no need to sort when you're deleting $where_criteria->normalizeFields($table); $itable = $this->normalizeTable($table); $iwhere_criteria = $this->normalizeCriteria($table, $where_criteria); try { $ret_bool = $this->_kill($itable, $iwhere_criteria); if ($this->hasDebug()) { if (!is_bool($ret_bool)) { throw new UnexpectedValueException(sprintf('_%s() expected to return: boolean, got: %s', __FUNCTION__, gettype($ret_bool))); } //if } //if } catch (Exception $e) { if ($this->handleException($e, $table)) { $ret_bool = $this->_kill($itable, $iwhere_criteria); } //if } //try/catch return $ret_bool; }