From 64b5c8098711e1cfba97861edb5eba2f83d6d99d Mon Sep 17 00:00:00 2001 From: Vendict Date: Sat, 21 Aug 2021 19:15:44 +0300 Subject: [PATCH] Add IN and NOT IN in WHERE clause But on right side use only RAW. --- src/Medoo.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Medoo.php b/src/Medoo.php index 324d3697..1d3a4c28 100644 --- a/src/Medoo.php +++ b/src/Medoo.php @@ -856,7 +856,7 @@ protected function dataImplode(array $data, array &$map, string $conjunctor): st $isIndex = is_int($key); preg_match( - '/([\p{L}_][\p{L}\p{N}@$#\-_\.]*)(\[(?\>\=?|\<\=?|\!|\<\>|\>\<|\!?~|REGEXP)\])?([\p{L}_][\p{L}\p{N}@$#\-_\.]*)?/u', + '/([\p{L}_][\p{L}\p{N}@$#\-_\.]*)(\[(?\>\=?|\<\=?|\!|\<\>|\>\<|\!?~|REGEXP|IN|NOT IN)\])?([\p{L}_][\p{L}\p{N}@$#\-_\.]*)?/u', $isIndex ? $value : $key, $match ); @@ -965,6 +965,9 @@ protected function dataImplode(array $data, array &$map, string $conjunctor): st } elseif ($operator === 'REGEXP') { $stack[] = "{$column} REGEXP {$mapKey}"; $map[$mapKey] = [$value, PDO::PARAM_STR]; + } elseif ($operator === 'NOT IN' || $operator === 'IN') { + $raw = $this->buildRaw($value, $map); + $stack[] = "{$column} {$operator} {$raw}"; } continue;