sqlparser-devexpress 2.5.5 → 2.5.6

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.5.5",
3
+ "version": "2.5.6",
4
4
  "main": "src/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -149,6 +149,20 @@ function DevExpressConverter() {
149
149
  const leftDefault = ast.left?.args && ast.left?.args[1]?.value;
150
150
  const right = ast.right !== undefined ? processAstNode(ast.right) : convertValue(ast.value);
151
151
  const rightDefault = ast.right?.args && ast.right?.args[1]?.value;
152
+
153
+ // Short-circuit when ISNULL's first arg is a placeholder (resolved concrete value, not a column).
154
+ // evaluateExpression cannot handle non-numeric string comparisons (e.g. "INV1" = ""),
155
+ // so detect and short-circuit here before any ISNULL column-null handling runs.
156
+ if (EnableShortCircuit && ast.left?.type === "function" && ast.left?.name === "ISNULL" &&
157
+ ast.left?.args?.[0]?.value?.type === "placeholder") {
158
+ if (IsValueNullShortCircuit && (left === null || right === null)) return true;
159
+ if (left !== null && right !== null) {
160
+ const normalL = normalizeBool(left);
161
+ const normalR = normalizeBool(right);
162
+ return normalL === normalR ? true : false;
163
+ }
164
+ }
165
+
152
166
  let operatorToken = ast.operator.toLowerCase();
153
167
  let includeExtradata = false;
154
168
 
@@ -440,6 +440,21 @@ describe("Parser SQL to dx Filter Builder", () => {
440
440
  ["CompanyID", "=", false]
441
441
  ]
442
442
  ]
443
+ ],
444
+ },
445
+ {
446
+ input: "BranchID = {AdjustmentDocument.BranchID} AND CompanyID = {AdjustmentDocument.CompanyID} AND IsFromInvoice = {AdjustmentDocument.IsFromInvoice} AND (SupplierInvoiceNO IN ('{AdjustmentDocument.SupplierInvoiceNos}') OR ISNULL('{AdjustmentDocument.SupplierInvoiceNos}','''') = '''')",
447
+ expected: [
448
+ [
449
+ ["BranchID", "=", 42],
450
+ "and",
451
+ ["CompanyID", "=", 7],
452
+ "and",
453
+ ["IsFromInvoice", "=", true],
454
+ ],
455
+ "and",
456
+ ["SupplierInvoiceNO", "=", "INV1"]
457
+
443
458
  ]
444
459
  }
445
460
  ];
@@ -513,7 +528,11 @@ const sampleData = {
513
528
  "PurchaseOrderDocument.IsMultiBrand": false,
514
529
  "PurchaseOrderDocument.AllowedApplicableMake": "0",
515
530
  "SampleDoc.AuthFilterID": "ID",
516
- "ItemPrice.AllowedItemGroupType": "1,2",
531
+ "ItemPrice.AllowedItemGroupType": "1,2",
517
532
  "ItemPrice.AllowedNonStock": 1,
518
- "ItemPrice.CompanyID": 7
533
+ "ItemPrice.CompanyID": 7,
534
+ "AdjustmentDocument.BranchID": 42,
535
+ "AdjustmentDocument.CompanyID": 7,
536
+ "AdjustmentDocument.IsFromInvoice": true,
537
+ "AdjustmentDocument.SupplierInvoiceNos": "INV1"
519
538
  };