Skip to content

Commit 80e6705

Browse files
committed
Add flush to query builder
1 parent 1ef7015 commit 80e6705

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"email": "[email protected]"
1010
}
1111
],
12-
"version": "0.0.18",
12+
"version": "0.0.19",
1313
"autoload": {
1414
"psr-4": {
1515
"MyDB\\": "src/"

src/QueryBuilder/Abstract/AQueryBuilder.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ abstract class AQueryBuilder implements IQueryBuilder {
3131
abstract protected function getWhereClause(): ?string;
3232
abstract protected function getGroupByClause(): ?string;
3333
abstract protected function getOrderByClause(): ?string;
34+
35+
public function flush(): void {
36+
$this->columns = ['*'];
37+
$this->params = [];
38+
$this->where = [];
39+
$this->having = null;
40+
$this->groupBy = [];
41+
$this->orderBy = [];
42+
$this->limitStart = 0;
43+
$this->limitTake = 0;
44+
}
3445
public function useDb(MyDB $db): void {
3546
$this->db = $db;
3647
}

src/QueryBuilder/IQueryBuilder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,5 @@ public function insertMultiple(array $data): bool;
5252
* @param array<string, int|string|float|bool|null> $data
5353
*/
5454
public function update(array $data): bool;
55+
public function flush(): void;
5556
}

0 commit comments

Comments
 (0)