Skip to content

Commit e474e6a

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

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

system/Database/Query.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,19 +279,14 @@ 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)))) {
291285
if (empty($this->bindMarker)) {
292286
return;
293287
}
294288

289+
$bindCount = count($binds);
295290
$ml = strlen($this->bindMarker);
296291

297292
$this->finalQueryString = $this->matchSimpleBinds($sql, $binds, $bindCount, $ml);

0 commit comments

Comments
 (0)