sqlparser-devexpress 2.5.7 → 2.5.8
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 +1 -1
- package/src/core/converter.js +3 -1
- package/tests/parser.test.js +28 -1
package/package.json
CHANGED
package/src/core/converter.js
CHANGED
|
@@ -238,7 +238,9 @@ function DevExpressConverter() {
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
// Apply short-circuit evaluation if enabled
|
|
241
|
-
|
|
241
|
+
// Skip for "IS NOT" (e.g. "col IS NOT NULL"): its null is a literal from the query
|
|
242
|
+
// itself, not a placeholder resolving to null, so it must remain a real filter.
|
|
243
|
+
if (EnableShortCircuit && IsValueNullShortCircuit && originalOperator !== "IS NOT" && (left == null || right == null)) {
|
|
242
244
|
return true; // If either value is null, return true for short-circuit evaluation
|
|
243
245
|
}
|
|
244
246
|
|
package/tests/parser.test.js
CHANGED
|
@@ -478,6 +478,30 @@ describe("Parser SQL to dx Filter Builder", () => {
|
|
|
478
478
|
["SupplierInvoiceNO", "=", "INV1"]
|
|
479
479
|
|
|
480
480
|
]
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
input: `DocType IN ({QuoteDocument.AllowedDocType})
|
|
484
|
+
AND CompanyID = {QuoteDocument.CompanyID}
|
|
485
|
+
AND
|
|
486
|
+
(
|
|
487
|
+
{QuoteDocument.IsVehicle} = 0
|
|
488
|
+
OR
|
|
489
|
+
(
|
|
490
|
+
{QuoteDocument.IsVehicle} = 1
|
|
491
|
+
AND ProspectID IS NOT NULL
|
|
492
|
+
)
|
|
493
|
+
)`,
|
|
494
|
+
expected: [
|
|
495
|
+
[
|
|
496
|
+
["DocType", "=", "10809"],
|
|
497
|
+
"or",
|
|
498
|
+
["DocType", "=", "40927"]
|
|
499
|
+
],
|
|
500
|
+
"and",
|
|
501
|
+
["CompanyID", "=", 2],
|
|
502
|
+
"and",
|
|
503
|
+
["ProspectID", "!=", null, { "type": "IS NOT" }, null]
|
|
504
|
+
]
|
|
481
505
|
}
|
|
482
506
|
];
|
|
483
507
|
|
|
@@ -558,5 +582,8 @@ const sampleData = {
|
|
|
558
582
|
"AdjustmentDocument.BranchID": 42,
|
|
559
583
|
"AdjustmentDocument.CompanyID": 7,
|
|
560
584
|
"AdjustmentDocument.IsFromInvoice": true,
|
|
561
|
-
"AdjustmentDocument.SupplierInvoiceNos": "INV1"
|
|
585
|
+
"AdjustmentDocument.SupplierInvoiceNos": "INV1",
|
|
586
|
+
"QuoteDocument.AllowedDocType": "10809,40927",
|
|
587
|
+
"QuoteDocument.CompanyID": 2,
|
|
588
|
+
"QuoteDocument.IsVehicle": true
|
|
562
589
|
};
|