sqlparser-devexpress 2.5.8 → 2.5.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 +1 -1
- package/src/core/converter.js +4 -5
- package/tests/parser.test.js +1 -1
package/package.json
CHANGED
package/src/core/converter.js
CHANGED
|
@@ -240,7 +240,10 @@ function DevExpressConverter() {
|
|
|
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
242
|
// itself, not a placeholder resolving to null, so it must remain a real filter.
|
|
243
|
-
|
|
243
|
+
// Avoid null short-circuit when comparison is produced from ISNULL(column, default),
|
|
244
|
+
// otherwise OR branches like ISNULL(CompanyID,0)=param OR ISNULL(CompanyID,0)=0
|
|
245
|
+
// can collapse to a full-match filter when param is null.
|
|
246
|
+
if (EnableShortCircuit && IsValueNullShortCircuit && originalOperator !== "IS NOT" && (left == null || right == null) && !isLeftNullCheck && !isRightNullCheck) {
|
|
244
247
|
return true; // If either value is null, return true for short-circuit evaluation
|
|
245
248
|
}
|
|
246
249
|
|
|
@@ -359,10 +362,6 @@ function DevExpressConverter() {
|
|
|
359
362
|
}
|
|
360
363
|
}
|
|
361
364
|
|
|
362
|
-
if (EnableShortCircuit && IsValueNullShortCircuit && (ast.field?.type === "placeholder" || ast.value?.type === "placeholder" || ast.value === null) && resolvedValue === null) {
|
|
363
|
-
return true;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
365
|
let operatorToken = operator === "IN" ? '=' : operator === "NOT IN" ? '!=' : operator;
|
|
367
366
|
let joinOperatorToken = operator === "IN" ? 'or' : operator === "NOT IN" ? 'and' : operator;
|
|
368
367
|
let field = convertValue(ast.field);
|
package/tests/parser.test.js
CHANGED
|
@@ -276,7 +276,7 @@ describe("Parser SQL to dx Filter Builder", () => {
|
|
|
276
276
|
},
|
|
277
277
|
{
|
|
278
278
|
input: "ID IN ({SaleOrderStatusStmtGlobalRpt.RegionID})",
|
|
279
|
-
expected: []
|
|
279
|
+
expected: ["ID","=",null]
|
|
280
280
|
},
|
|
281
281
|
{
|
|
282
282
|
input: "10 < ID AND ApplicableUoms IN ({WorkOrderLine.ApplicableUoms})",
|