Skip to content

Commit b830fbd

Browse files
committed
ADD method disableQueryOptimizer in SelectQuery
REMOVED flags arguments in executeQuery.
1 parent 5999b2d commit b830fbd

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/DatabaseHandler.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
class DatabaseHandler
2323
{
24-
public const FLAG_DISABLE_OPTIMIZER = 0b00010000;
25-
2624
private $compiler;
2725
private $driver;
2826

@@ -88,9 +86,9 @@ public function setChunkSize(?int $chunkSize)
8886
$this->chunkSize = $chunkSize;
8987
}
9088

91-
public function executeSelect(SelectQuery $query, int $flags = 0): SelectResult
89+
public function executeSelect(SelectQuery $query): SelectResult
9290
{
93-
if (($flags & self::FLAG_DISABLE_OPTIMIZER) === 0) {
91+
if (!$query->isQueryOptimizerDisabled()) {
9492
$query = QueryOptimizer::optimizeSelect($query);
9593
}
9694
$compiled = $this->compiler->compileSelect($query);

src/SelectQuery.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,16 @@ public function getAfterExecuteActions()
167167
return $this->actions;
168168
}
169169
#endregion
170+
171+
private $disabledQueryOptimizer = false;
172+
173+
public function disableQueryOptimizer($disabled = true)
174+
{
175+
$this->disabledQueryOptimizer = $disabled;
176+
}
177+
178+
public function isQueryOptimizerDisabled()
179+
{
180+
return $this->disabledQueryOptimizer;
181+
}
170182
}

0 commit comments

Comments
 (0)