Skip to content

Commit 801ec70

Browse files
committed
Update SqliteLikeHandler.php
1 parent 6ebb760 commit 801ec70

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/Reader/FilterHandler/LikeHandler/SqliteLikeHandler.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,9 @@ final class SqliteLikeHandler extends BaseLikeHandler implements QueryBuilderFil
2424
*/
2525
public function getAsWhereArguments(FilterInterface $filter, array $handlers): array
2626
{
27-
assert($filter instanceof Like);
28-
29-
if (isset($filter->options['escape'])) {
30-
throw new NotSupportedFilterOptionException(
31-
'Escape option is not supported in SQLite LIKE queries.',
32-
'sqlite',
33-
);
34-
}
27+
$allowedModes = [LikeMode::Contains, LikeMode::StartsWith, LikeMode::EndsWith];
3528

3629
/** @var Like $filter */
37-
38-
$allowedModes = [LikeMode::Contains, LikeMode::StartsWith, LikeMode::EndsWith];
3930
$modeName = $filter->mode->name;
4031

4132
if (!in_array($filter->mode, $allowedModes, true)) {
@@ -44,7 +35,10 @@ public function getAsWhereArguments(FilterInterface $filter, array $handlers): a
4435
'sqlite',
4536
);
4637
}
47-
38+
39+
// The above escaping replacements will be used to build the pattern
40+
// in the event of escape characters (% or _) being found in the $filter->value
41+
// Sqlite does not have the ESCAPE command available
4842
$pattern = $this->prepareValue($filter->value, $filter->mode);
4943

5044
if ($filter->caseSensitive === true) {

0 commit comments

Comments
 (0)