code cleanup
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Driver\SQL\Query;
|
||||
|
||||
use Driver\SQL\Condition\CondOr;
|
||||
use Driver\SQL\SQL;
|
||||
|
||||
class Update extends Query {
|
||||
|
||||
@@ -10,28 +11,28 @@ class Update extends Query {
|
||||
private string $table;
|
||||
private array $conditions;
|
||||
|
||||
public function __construct($sql, $table) {
|
||||
public function __construct(SQL $sql, string $table) {
|
||||
parent::__construct($sql);
|
||||
$this->values = array();
|
||||
$this->table = $table;
|
||||
$this->conditions = array();
|
||||
}
|
||||
|
||||
public function where(...$conditions) {
|
||||
public function where(...$conditions): Update {
|
||||
$this->conditions[] = (count($conditions) === 1 ? $conditions : new CondOr($conditions));
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function set($key, $val) {
|
||||
public function set(string $key, $val): Update {
|
||||
$this->values[$key] = $val;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function execute() {
|
||||
public function execute(): bool {
|
||||
return $this->sql->executeUpdate($this);
|
||||
}
|
||||
|
||||
public function getTable() { return $this->table; }
|
||||
public function getConditions() { return $this->conditions; }
|
||||
public function getValues() { return $this->values; }
|
||||
public function getTable(): string { return $this->table; }
|
||||
public function getConditions(): array { return $this->conditions; }
|
||||
public function getValues(): array { return $this->values; }
|
||||
}
|
||||
Reference in New Issue
Block a user