Skip to content

Commit

Permalink
Merge pull request #10 from JulianVennen/fix-in-queries
Browse files Browse the repository at this point in the history
Fix encoding arrays for (NOT) IN queries
  • Loading branch information
matthi4s authored Jul 15, 2024
2 parents 9529c60 + bd11b9c commit 882e03c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Query/Generator/SQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,19 @@ protected function generateGroup(Query $query): string
/**
* Generate value for where ore field usage
*
* @param float|int|string|null $value
* @param float|int|string|array|null $value
* @return string
*/
private function generateValue(float|int|string|null $value): string
private function generateValue(float|int|string|null|array $value): string
{
if (is_array($value)) {
$values = [];
foreach ($value as $v) {
$values[] = $this->generateValue($v);
}
return "(" . implode(", ", $values) . ")";
}

if (is_int($value) || is_float($value)) {
return $value;
}
Expand Down

0 comments on commit 882e03c

Please sign in to comment.