/** * Called by the {@link save()} method to update the object * @param vars - (optional) An array of key,value pairs to be assigned * for this object * @access protected * @see insert,save */ protected function update($vars = '') { if (!$this->table->tainted()) { if ($vars) { $this->parse($vars); } $query = new UpdateQuery($this->tableName()); $fields = $this->table()->fields(); foreach ($fields as $cur_field) { if ($cur_field->requiresUpdate() && !$cur_field->key()) { if (!$cur_field->isSetted()) { $value = Query::clean($cur_field->value()); } else { $value = $cur_field->value(); } $query->updateField($cur_field->name(), $value, $cur_field->getQuotes()); $cur_field->updated(); } } $query->setClause($this->uniqueClause()); $query->doQuery(); $this->clearQueryCache(); //$this->table->refresh(); $ret = true; } else { $this->taintException(); } return $ret; }