sqlparser-devexpress 2.5.3 → 2.5.4
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 +7 -0
- package/tests/parser.test.js +6 -1
package/package.json
CHANGED
package/src/core/converter.js
CHANGED
|
@@ -308,6 +308,13 @@ function DevExpressConverter() {
|
|
|
308
308
|
resolvedValue = resolvedValue.split(',').map(v => v.trim());
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
// Short-circuit: Field being compared to itself (e.g., ID IN (ID))
|
|
312
|
+
if (EnableShortCircuit && typeof ast.field === 'string') {
|
|
313
|
+
if (typeof resolvedValue === 'string' && ast.field === resolvedValue) {
|
|
314
|
+
return operator === "IN" ? true : false;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
311
318
|
// handle short circuit evaluation for IN operator
|
|
312
319
|
if (EnableShortCircuit && (LITERAL_TYPES.includes(ast.field?.type) && LITERAL_TYPES.includes(ast.value?.type))) {
|
|
313
320
|
const fieldVal = convertValue(ast.field);
|
package/tests/parser.test.js
CHANGED
|
@@ -407,6 +407,10 @@ describe("Parser SQL to dx Filter Builder", () => {
|
|
|
407
407
|
expected: [
|
|
408
408
|
"AccountID", "=", 42
|
|
409
409
|
]
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
input: "ID IN ({SampleDoc.AuthFilterID})",
|
|
413
|
+
expected: []
|
|
410
414
|
}
|
|
411
415
|
];
|
|
412
416
|
|
|
@@ -477,5 +481,6 @@ const sampleData = {
|
|
|
477
481
|
"SaleOrderStatusStmtGlobalRpt.RegionID": null,
|
|
478
482
|
"WorkOrderLine.CompanyIDs": ["0,1"],
|
|
479
483
|
"PurchaseOrderDocument.IsMultiBrand": false,
|
|
480
|
-
"PurchaseOrderDocument.AllowedApplicableMake": "0"
|
|
484
|
+
"PurchaseOrderDocument.AllowedApplicableMake": "0",
|
|
485
|
+
"SampleDoc.AuthFilterID": "ID"
|
|
481
486
|
};
|