public function getQuery()
{
if (strlen($this->table) === 0) {
throw new QueryException('Missing table name');
}
if (count($this->values) === 0) {
throw new QueryException('Missing values');
}
if (count($this->where) === 0) {
throw new QueryException('Executing update without where clause is not allowed');
}
$set = array();
foreach ($this->values as $column => $expression) {
$set[] = $column . ' = ' . $expression;
}
return 'UPDATE ' . $this->table . ' SET ' . implode(', ', $set) . ' WHERE ' . implode(' AND ', $this->where);
}