sqlparser-devexpress 2.5.4 → 2.5.5
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/parser.js +9 -0
- package/tests/parser.test.js +34 -1
package/package.json
CHANGED
package/src/core/parser.js
CHANGED
|
@@ -164,6 +164,15 @@ export function parse(input, variables = []) {
|
|
|
164
164
|
operator: newOperator,
|
|
165
165
|
left: { type: "field", value: right }
|
|
166
166
|
};
|
|
167
|
+
} else {
|
|
168
|
+
// Regular comparison where left is a parenthesized expression or function result
|
|
169
|
+
const right = parseValue(operator);
|
|
170
|
+
left = {
|
|
171
|
+
type: "comparison",
|
|
172
|
+
left: left,
|
|
173
|
+
operator: operator,
|
|
174
|
+
value: right
|
|
175
|
+
};
|
|
167
176
|
}
|
|
168
177
|
}
|
|
169
178
|
|
package/tests/parser.test.js
CHANGED
|
@@ -411,6 +411,36 @@ describe("Parser SQL to dx Filter Builder", () => {
|
|
|
411
411
|
{
|
|
412
412
|
input: "ID IN ({SampleDoc.AuthFilterID})",
|
|
413
413
|
expected: []
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
input: "ItemGroupType IN ({ItemPrice.AllowedItemGroupType}) AND ((ISNULL(IsNonStock,0))={ItemPrice.AllowedNonStock}) AND (CompanyID = {ItemPrice.CompanyID} OR {ItemPrice.CompanyID} = 0 OR ISNULL(CompanyID,0) = 0)",
|
|
417
|
+
expected: [
|
|
418
|
+
[
|
|
419
|
+
[
|
|
420
|
+
["ItemGroupType", "=", "1"],
|
|
421
|
+
"or",
|
|
422
|
+
["ItemGroupType", "=", "2"]
|
|
423
|
+
],
|
|
424
|
+
"and",
|
|
425
|
+
[
|
|
426
|
+
["IsNonStock", "=", 1, { "defaultValue": 0, "position": "column", "type": "ISNULL" }, 1],
|
|
427
|
+
"or",
|
|
428
|
+
["IsNonStock", "=", true]
|
|
429
|
+
]
|
|
430
|
+
],
|
|
431
|
+
"and",
|
|
432
|
+
[
|
|
433
|
+
["CompanyID", "=", 7],
|
|
434
|
+
"or",
|
|
435
|
+
[
|
|
436
|
+
["CompanyID", "=", 0],
|
|
437
|
+
"or",
|
|
438
|
+
["CompanyID", "=", null, { "defaultValue": 0, "position": "column", "type": "ISNULL" }, null],
|
|
439
|
+
"or",
|
|
440
|
+
["CompanyID", "=", false]
|
|
441
|
+
]
|
|
442
|
+
]
|
|
443
|
+
]
|
|
414
444
|
}
|
|
415
445
|
];
|
|
416
446
|
|
|
@@ -482,5 +512,8 @@ const sampleData = {
|
|
|
482
512
|
"WorkOrderLine.CompanyIDs": ["0,1"],
|
|
483
513
|
"PurchaseOrderDocument.IsMultiBrand": false,
|
|
484
514
|
"PurchaseOrderDocument.AllowedApplicableMake": "0",
|
|
485
|
-
"SampleDoc.AuthFilterID": "ID"
|
|
515
|
+
"SampleDoc.AuthFilterID": "ID",
|
|
516
|
+
"ItemPrice.AllowedItemGroupType": "1,2",
|
|
517
|
+
"ItemPrice.AllowedNonStock": 1,
|
|
518
|
+
"ItemPrice.CompanyID": 7
|
|
486
519
|
};
|