From 397729a055e4a817b4ac5490f65d88be19f66ae1 Mon Sep 17 00:00:00 2001 From: Xavier Musy Date: Wed, 2 Oct 2019 13:40:39 -0700 Subject: [PATCH] Fixed toupper tolower mssql fixed toupper and tollower to use supported SQL Server functions --- src/visitor.ts | 4 ++-- test/mssql.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/visitor.ts b/src/visitor.ts index 669abaa..06162a5 100644 --- a/src/visitor.ts +++ b/src/visitor.ts @@ -376,12 +376,12 @@ export class Visitor{ this.where += ")"; break; case "tolower": - this.where += "LCASE("; + this.where += this.type === SQLLang.MsSql ? "LOWER(" : "LCASE("; this.Visit(params[0], context); this.where += ")"; break; case "toupper": - this.where += "UCASE("; + this.where += this.type === SQLLang.MsSql ? "UPPER(" :"UCASE("; this.Visit(params[0], context); this.where += ")"; break; diff --git a/test/mssql.spec.js b/test/mssql.spec.js index 3077afd..661ab16 100644 --- a/test/mssql.spec.js +++ b/test/mssql.spec.js @@ -109,11 +109,11 @@ describe("SQL WHERE useParameters (MS-SQL)", () => { }) it("expression 5.1.1.4.7: tolower(A) eq 'abc'", () => { - expect(f.where).to.equal("LCASE([A]) = @p0") + expect(f.where).to.equal("LOWER([A]) = @p0") }) it("expression 5.1.1.4.8: toupper(A) eq 'ABC'", () => { - expect(f.where).to.equal("UCASE([A]) = @p0") + expect(f.where).to.equal("UPPER([A]) = @p0") }) it("expression 5.1.1.4.9: trim(A) eq 'abc'", () => {