Skip to content

Commit a5897b0

Browse files
committed
Some refinement / optimization
Considering that $binds is usually an array, and that only matchSimpleBinds() needs the count.
1 parent 814a55b commit a5897b0

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

system/Database/Query.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,16 +279,11 @@ protected function compileBinds()
279279
return;
280280
}
281281

282-
if (! is_array($this->binds)) {
283-
$binds = [$this->binds];
284-
$bindCount = 1;
285-
} else {
286-
$binds = $this->binds;
287-
$bindCount = count($binds);
288-
}
282+
$binds = is_array($this->binds) ? $this->binds : [$this->binds];
289283

290284
if (is_numeric(key(array_slice($binds, 0, 1)))) {
291-
$ml = strlen($this->bindMarker);
285+
$bindCount = count($binds);
286+
$ml = strlen($this->bindMarker);
292287

293288
$this->finalQueryString = $this->matchSimpleBinds($sql, $binds, $bindCount, $ml);
294289
} else {

0 commit comments

Comments
 (0)