mirror of
https://codeberg.org/vlw/php-mysql.git
synced 2025-09-14 08:43:40 +02:00
feat: reset definers on new query start
This commit is contained in:
parent
98ed26a375
commit
831266d195
1 changed files with 7 additions and 2 deletions
|
@ -65,6 +65,11 @@
|
||||||
|
|
||||||
// Use the following table name
|
// Use the following table name
|
||||||
public function for(string $table): self {
|
public function for(string $table): self {
|
||||||
|
// Reset all definers when a new query begins
|
||||||
|
$this->where();
|
||||||
|
$this->limit();
|
||||||
|
$this->order();
|
||||||
|
|
||||||
$this->table = $table;
|
$this->table = $table;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +156,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// SQL LIMIT string
|
// SQL LIMIT string
|
||||||
public function limit(?int $limit, ?int $offset = null): self {
|
public function limit(?int $limit = null, ?int $offset = null): self {
|
||||||
// Unset row limit if null was passed
|
// Unset row limit if null was passed
|
||||||
if ($limit === null) {
|
if ($limit === null) {
|
||||||
$this->limit = null;
|
$this->limit = null;
|
||||||
|
@ -182,7 +187,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return SQL SORT BY string from assoc array of columns and direction
|
// Return SQL SORT BY string from assoc array of columns and direction
|
||||||
public function order(?array $order_by): self {
|
public function order(?array $order_by = null): self {
|
||||||
// Unset row order by if null was passed
|
// Unset row order by if null was passed
|
||||||
if ($order_by === null) {
|
if ($order_by === null) {
|
||||||
$this->order_by = null;
|
$this->order_by = null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue