Skip to content

Commit

Permalink
fix it using lower, can use a function based index
Browse files Browse the repository at this point in the history
  • Loading branch information
butonic committed Apr 27, 2018
1 parent 499704b commit 45fa905
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/private/DB/AdapterOCI8.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function lastInsertId($table) {

public function fixupStatement($statement) {
$statement = \preg_replace('( LIKE \?)', '$0 ESCAPE \'\\\'', $statement);
$statement = \preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, \'^\' || REPLACE(?, \'%\', \'.*\') || \'$\', \'i\')', $statement);
$statement = \preg_replace('/`(\w+)` ILIKE \?/', "LOWER(`$1`) LIKE LOWER(?) ESCAPE '\\' -- \\'' \n", $statement); // FIXME workaround for singletick matching with regexes in SQLParserUtils::getUnquotedStatementFragments
$statement = \str_replace('`', '"', $statement);
$statement = \str_ireplace('NOW()', 'CURRENT_TIMESTAMP', $statement);
$statement = \str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function castColumn($column, $type) {
public function iLike($x, $y, $type = null) {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return new QueryFunction('REGEXP_LIKE('.$x.', \'^\' || REPLACE('.$y.', \'%\', \'.*\') || \'$\', \'i\')');
return new QueryFunction("LOWER($x) LIKE LOWER($y) ESCAPE '\\' -- \\'' \n"); // FIXME workaround for singletick matching with regexes in SQLParserUtils::getUnquotedStatementFragments
}

/**
Expand Down

0 comments on commit 45fa905

Please sign in to comment.