Minor update
This commit is contained in:
@@ -18,6 +18,7 @@ class Select extends Query {
|
||||
private bool $sortAscending;
|
||||
private int $limit;
|
||||
private int $offset;
|
||||
private bool $forUpdate;
|
||||
|
||||
public function __construct($sql, ...$selectValues) {
|
||||
parent::__construct($sql);
|
||||
@@ -31,6 +32,7 @@ class Select extends Query {
|
||||
$this->limit = 0;
|
||||
$this->offset = 0;
|
||||
$this->sortAscending = true;
|
||||
$this->forUpdate = false;
|
||||
}
|
||||
|
||||
public function from(...$tables): Select {
|
||||
@@ -88,6 +90,11 @@ class Select extends Query {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function lockForUpdate(): Select {
|
||||
$this->forUpdate = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function execute() {
|
||||
return $this->sql->executeQuery($this, true);
|
||||
}
|
||||
@@ -174,6 +181,7 @@ class Select extends Query {
|
||||
|
||||
$limit = ($this->getLimit() > 0 ? (" LIMIT " . $this->getLimit()) : "");
|
||||
$offset = ($this->getOffset() > 0 ? (" OFFSET " . $this->getOffset()) : "");
|
||||
return "SELECT $selectValues FROM $tables$joinStr$where$groupBy$havingClause$orderBy$limit$offset";
|
||||
$forUpdate = ($this->forUpdate ? " FOR UPDATE" : "");
|
||||
return "SELECT $selectValues FROM $tables$joinStr$where$groupBy$havingClause$orderBy$limit$offset$forUpdate";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user