Skip to content

Commit 95d85ab

Browse files
committed
indexOf fixed for SQL Server
1 parent 8cc19a4 commit 95d85ab

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/compiler/sql-server/SqlServerSqlMethodTransformer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export const SqlServerSqlHelper: ISqlHelpers = {
193193
return ["(", (x)=> joinMap(" OR ", x, test, (item) => [ "(" , text, " like ", () => item , ")" ]), ")"] as any;
194194
},
195195
indexOf(text, test) {
196-
return prepareAny `(CHARINDEX(${text}, ${test}) - 1)`;
196+
return prepareAny `(CHARINDEX(${test}, ${text}) - 1)`;
197197
},
198198
left(text, length) {
199199
return prepareAny `left(${text}, ${length})`;

src/sql/ISql.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ export interface ISql {
5656
left(text: string, length: number): string;
5757
length(text: string): number;
5858
right(text: string, length: number): string;
59-
startsWith(text: string, test: string): boolean;
60-
endsWith(text: string, test: string): boolean;
59+
startsWith(text: string, textToFind: string): boolean;
60+
endsWith(text: string, textToFind: string): boolean;
6161
/**
6262
* This will return index of given search, and it will
6363
* return -1 if test value is not found. If underlying provider
6464
* supports 1 as starting index, 1 will be subtracted from given result.
6565
* @param text string to be searched in
6666
* @param test string to search
6767
*/
68-
indexOf(text: string, test: string): number;
69-
includes(text: string, test: string): boolean;
68+
indexOf(text: string, textToFind: string): number;
69+
includes(text: string, textToFind: string): boolean;
7070
normalize(text: string, kind?: string): string;
7171
collate(text: string, collation: string): string;
7272
lower(text: string): string;

0 commit comments

Comments
 (0)