sqlparser-devexpress 2.5.1 → 2.5.2
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 +3 -3
- package/src/core/converter.js +10 -6
- package/tests/parser.test.js +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sqlparser-devexpress",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"types": "src/@types/default.d.ts",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/RohitM-IN/SQLParser.git"
|
|
16
|
+
"url": "git+https://github.com/RohitM-IN/SQLParser.git"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"sql",
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"vitest": "^3.0.5"
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|
package/src/core/converter.js
CHANGED
|
@@ -518,13 +518,17 @@ function DevExpressConverter() {
|
|
|
518
518
|
return null; // Any comparison with null should return null
|
|
519
519
|
}
|
|
520
520
|
|
|
521
|
+
// Normalize boolean values to numbers for comparison with numbers
|
|
522
|
+
const normalizedLeft = normalizeBool(left);
|
|
523
|
+
const normalizedRight = normalizeBool(right);
|
|
524
|
+
|
|
521
525
|
switch (operator) {
|
|
522
|
-
case '=': case '==': return
|
|
523
|
-
case '<>': case '!=': return
|
|
524
|
-
case '>': return
|
|
525
|
-
case '>=': return
|
|
526
|
-
case '<': return
|
|
527
|
-
case '<=': return
|
|
526
|
+
case '=': case '==': return normalizedLeft === normalizedRight;
|
|
527
|
+
case '<>': case '!=': return normalizedLeft !== normalizedRight;
|
|
528
|
+
case '>': return normalizedLeft > normalizedRight;
|
|
529
|
+
case '>=': return normalizedLeft >= normalizedRight;
|
|
530
|
+
case '<': return normalizedLeft < normalizedRight;
|
|
531
|
+
case '<=': return normalizedLeft <= normalizedRight;
|
|
528
532
|
default: return null; // Invalid operator
|
|
529
533
|
}
|
|
530
534
|
}
|
package/tests/parser.test.js
CHANGED
|
@@ -388,6 +388,18 @@ describe("Parser SQL to dx Filter Builder", () => {
|
|
|
388
388
|
["AllowSubDealer", "=", true],
|
|
389
389
|
'or',
|
|
390
390
|
["AllowSubDealer", "=", null, { "type": "ISNULL", "position": "column", "defaultValue": 1 }, null]
|
|
391
|
+
],
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
input: "(CompanyID = {LeadDocument.CompanyID} OR CompanyID IS NULL) AND ItemGroupType IN ({Item.AllowedItemGroupTypeOne}) AND ({PurchaseOrderDocument.IsMultiBrand} = 0 OR ({PurchaseOrderDocument.IsMultiBrand} = 1 AND Make IN ({PurchaseOrderDocument.AllowedApplicableMake})))",
|
|
395
|
+
expected: [
|
|
396
|
+
[
|
|
397
|
+
["CompanyID", "=", 7],
|
|
398
|
+
"or",
|
|
399
|
+
["CompanyID", "=", null, { "type": "IS" }, null]
|
|
400
|
+
],
|
|
401
|
+
"and",
|
|
402
|
+
["ItemGroupType", "=", "1"]
|
|
391
403
|
]
|
|
392
404
|
}
|
|
393
405
|
];
|
|
@@ -428,6 +440,7 @@ describe("Parser SQL to dx Filter Builder", () => {
|
|
|
428
440
|
|
|
429
441
|
|
|
430
442
|
const sampleData = {
|
|
443
|
+
"Example.ZeroValue": 0,
|
|
431
444
|
"CoreEntity0022.CompanyGroupID": 42,
|
|
432
445
|
"CoreEntity0022.BranchID": 7,
|
|
433
446
|
"Employee.District": 0,
|
|
@@ -441,6 +454,7 @@ const sampleData = {
|
|
|
441
454
|
"Item.ID": 42,
|
|
442
455
|
"Item.BranchID": 7,
|
|
443
456
|
"Item.AllowedItemGroupType": "1,2",
|
|
457
|
+
"Item.AllowedItemGroupTypeOne": "1",
|
|
444
458
|
"WorkOrderLine.ApplicableUoms": ["UOM1", "UOM2", "UOM3"],
|
|
445
459
|
"WorkOrderLine.CompanyID": 2,
|
|
446
460
|
"WorkOrderDocument.CompanyID": 42,
|
|
@@ -456,4 +470,6 @@ const sampleData = {
|
|
|
456
470
|
"SaleOrderStatusStmtGlobalRpt.StateID": null,
|
|
457
471
|
"SaleOrderStatusStmtGlobalRpt.RegionID": null,
|
|
458
472
|
"WorkOrderLine.CompanyIDs": ["0,1"],
|
|
473
|
+
"PurchaseOrderDocument.IsMultiBrand": false,
|
|
474
|
+
"PurchaseOrderDocument.AllowedApplicableMake": "0"
|
|
459
475
|
};
|