sqlparser-devexpress 2.3.7 → 2.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sqlparser-devexpress",
3
- "version": "2.3.7",
3
+ "version": "2.3.9",
4
4
  "main": "src/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -138,18 +138,19 @@ function DevExpressConverter() {
138
138
  const right = ast.right !== undefined ? processAstNode(ast.right) : convertValue(ast.value);
139
139
  let operatorToken = ast.operator.toLowerCase();
140
140
 
141
- if(operatorToken === "like") {
141
+ if (operatorToken === "like") {
142
142
  operatorToken = "contains";
143
- }else if (operatorToken === "not like") {
143
+ } else if (operatorToken === "not like") {
144
144
  operatorToken = "notcontains";
145
145
  }
146
146
 
147
147
  let comparison = [left, operatorToken, right];
148
148
 
149
+ // Last null because of special case when using dropdown it https://github.com/DevExpress/DevExtreme/blob/25_1/packages/devextreme/js/__internal/data/m_utils.ts#L18 it takes last value as null
149
150
  if ((ast.left && isFunctionNullCheck(ast.left, true)) || (ast.value && isFunctionNullCheck(ast.value, false))) {
150
- comparison = [[left, operatorToken, right], 'or', [left, operatorToken, null, {type: "ISNULL", defaultValue: (ast.left ?? ast.value).args[1]?.value}]];
151
+ comparison = [[left, operatorToken, right], 'or', [left, operatorToken, null, { type: "ISNULL", defaultValue: (ast.left ?? ast.value).args[1]?.value }, null]];
151
152
  } else if (ast.right && isFunctionNullCheck(ast.right, true)) {
152
- comparison = [[left, operatorToken, right], 'or', [right, operatorToken, null, {type: "ISNULL", defaultValue: ast.right.args[1]?.value}]];
153
+ comparison = [[left, operatorToken, right], 'or', [right, operatorToken, null, { type: "ISNULL", defaultValue: ast.right.args[1]?.value }, null]];
153
154
  }
154
155
 
155
156
  // Apply short-circuit evaluation if enabled
@@ -229,8 +230,8 @@ function DevExpressConverter() {
229
230
  if (typeof val === "object") {
230
231
  if (val.type === "placeholder") {
231
232
  const placeholderValue = resolvePlaceholderFromResultObject(val.value);
232
-
233
- if(val?.dataType === "string"){
233
+
234
+ if (val?.dataType === "string") {
234
235
  return placeholderValue?.toString();
235
236
  }
236
237
 
@@ -137,11 +137,11 @@ describe("Parser SQL to dx Filter Builder", () => {
137
137
  expected: [
138
138
  ["SourceID", "=", 2],
139
139
  "or",
140
- ["SourceID", "=", null,{ "defaultValue": 0, "type": "ISNULL"}],
140
+ ["SourceID", "=", null, { "defaultValue": 0, "type": "ISNULL" }, null],
141
141
  "or",
142
142
  ["SourceID", "=", 0],
143
143
  "or",
144
- ["SourceID", "=", null,{ "defaultValue": 0, "type": "ISNULL"}]
144
+ ["SourceID", "=", null, { "defaultValue": 0, "type": "ISNULL" }, null]
145
145
  ]
146
146
  },
147
147
  {
@@ -153,14 +153,14 @@ describe("Parser SQL to dx Filter Builder", () => {
153
153
  [
154
154
  ["CompanyID", "=", 0],
155
155
  "or",
156
- ["CompanyID", "=", null,{ "defaultValue": 0, "type": "ISNULL"}]
156
+ ["CompanyID", "=", null, { "defaultValue": 0, "type": "ISNULL" }, null]
157
157
  ]
158
158
  ],
159
159
  "and",
160
160
  [
161
161
  ["IsSubdealer", "=", true],
162
162
  "or",
163
- ["IsSubdealer", "=", null,{ "defaultValue": 0, "type": "ISNULL"}]
163
+ ["IsSubdealer", "=", null, { "defaultValue": 0, "type": "ISNULL" }, null]
164
164
  ]
165
165
  ]
166
166
  },
@@ -187,7 +187,7 @@ describe("Parser SQL to dx Filter Builder", () => {
187
187
  expected: [
188
188
  ["TicketID", "=", 123],
189
189
  "or",
190
- ["TicketID", "=", null,{ "defaultValue": 0, "type": "ISNULL"}]
190
+ ["TicketID", "=", null, { "defaultValue": 0, "type": "ISNULL" }, null]
191
191
  ]
192
192
  },
193
193
  {
@@ -195,14 +195,12 @@ describe("Parser SQL to dx Filter Builder", () => {
195
195
  expected: [
196
196
  ["CompanyID", "=", 7],
197
197
  "or",
198
- ["CompanyID", "=", null,{ "defaultValue": 0, "type": "ISNULL"}],
198
+ ["CompanyID", "=", null, { "defaultValue": 0, "type": "ISNULL" }, null],
199
199
  "or",
200
200
  ["CompanyID", "=", 0],
201
201
  "or",
202
- ["CompanyID", "=", null,{ "defaultValue": 0, "type": "ISNULL"},
202
+ ["CompanyID", "=", null, { "defaultValue": 0, "type": "ISNULL" }, null]
203
203
 
204
- ]
205
-
206
204
  ]
207
205
  },
208
206
  {