/** * Compiles a delete string and runs the query. * * @param string table name * @param array where clause * @return Database_Result Query result */ public function delete($table = '', $where = NULL) { if ($table == '') { if (!isset($this->_from[0])) { throw new KoException('database.must_use_table'); } $table = $this->_from[0]; } else { $table = $this->_config['table_prefix'] . $table; } if (!is_null($where)) { $this->where($where); } if (count($this->_where) < 1) { throw new KoException('database.must_use_where'); } $sql = $this->_driver->delete($table, $this->_where); $this->reset(); return $this->query($sql); }