/** * Compiles an update string and runs the query. * * @param string table name * @param array associative array of update values * @param array where clause * @return Database_Result Query result */ public function update($table = '', $set = NULL, $where = NULL) { if (is_array($set)) { $this->setValue($set); } if (!is_null($where)) { $this->where($where); } if ($this->_set == FALSE) { throw new KoException('database.must_use_set'); } if ($table == '') { if (!isset($this->_from[0])) { throw new KoException('database.must_use_table'); } $table = $this->_from[0]; } $sql = $this->_driver->update($this->_config['table_prefix'] . $table, $this->_set, $this->_where); $this->reset(); return $this->query($sql); }