/** Delete row * @return int number of affected rows or false in case of an error */ function delete() { // delete is an SQL keyword $result = new NotORMResult($this->result->table, $this->result->notORM); $return = $result->where($this->result->primary, $this->primary)->delete(); $this->primary = $this[$this->result->primary]; return $return; }
protected function execute() { if (!isset($this->rows)) { $referencing =& $this->result->referencing[$this->__toString()]; if (!isset($referencing)) { if (!$this->limit || count($this->result->rows) <= 1 || $this->union) { parent::execute(); } else { //! doesn't work with union $result = clone $this; $first = true; foreach ((array) $this->result->rows as $val) { if ($first) { $result->where[0] = "{$this->column} = " . $this->quote($val); $first = false; } else { $clone = clone $this; $clone->where[0] = "{$this->column} = " . $this->quote($val); $result->union($clone); } } $result->execute(); $this->rows = $result->rows; } $referencing = array(); foreach ($this->rows as $key => $row) { $referencing[$row[$this->column]][$key] = $row; } } $this->data =& $referencing[$this->active]; if (!isset($this->data)) { $this->data = array(); } } }