Skip to content

Commit 4faa35d

Browse files
committed
Simplified escape character for searching
1 parent fd2ccdf commit 4faa35d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/database/schemas.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ function getFilterClause(againstColumn: string, filter: string, noAnd?: boolean)
2626

2727
let clause = `${noAnd ? '' : 'AND'} UPPER(${againstColumn})`;
2828
let parameters: BasicColumnType[] = [];
29-
let hasEscapeChar = false;
30-
31-
if (filter.indexOf('\\\\') >= 0) {
32-
hasEscapeChar = true;
33-
filter = filter.replace(/\\\\/g, '@');
34-
}
3529

3630
if (filter.endsWith(`*`)) {
3731
clause += ` LIKE ? CONCAT '%'`;
@@ -41,8 +35,8 @@ function getFilterClause(againstColumn: string, filter: string, noAnd?: boolean)
4135
parameters.push(filter.toUpperCase());
4236
}
4337

44-
if (hasEscapeChar) {
45-
clause += ` ESCAPE '@'`;
38+
if (filter.indexOf('\\') >= 0) {
39+
clause += ` ESCAPE '\\'`;
4640
}
4741

4842
return {

0 commit comments

Comments
 (0)