sqlparser-devexpress 2.0.5 → 2.0.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sqlparser-devexpress",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "main": "src/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -6,8 +6,8 @@ const tokenPatterns = {
6
6
  number: "\\d+", // Matches numerical values
7
7
  placeholder: "'?\\{[^}]+\\}'?", // Matches placeholders like {variable} or '{variable}'
8
8
  string: "'(?:''|[^'])*'", // Matches strings, allowing for escaped single quotes ('')
9
- operator: "=>|<=|!=|>=|=|<>|>|<|AND|OR|BETWEEN|IN|LIKE|IS", // Matches SQL operators and logical keywords
10
9
  identifier: "[\\w.]+", // Matches identifiers, including table.column format
10
+ operator: "(?<!\w)(=>|<=|!=|>=|=|<>|>|<|AND|OR|BETWEEN|IN|LIKE|IS)(?!\w)", // Matches SQL operators and logical keywords
11
11
  paren: "[()]", // Matches parentheses
12
12
  comma: "," // Matches commas
13
13
  };
@@ -40,7 +40,7 @@ class Tokenizer {
40
40
  const type = [...tokenTypeMap.keys()].find(name => match.groups[name] !== undefined);
41
41
 
42
42
  // Skip whitespace tokens
43
- if (!type || type === "whitespace") return this.nextToken();
43
+ if (!type || type === "whitespace") return this.nextToken();
44
44
 
45
45
  let value = match.groups[type];
46
46
 
package/src/index.js CHANGED
@@ -38,6 +38,6 @@ export function convertAstToDevextreme(ast, variables, state) {
38
38
  // Example usage
39
39
  // const devExpressFilter = parseFilterString("((ISNULL({0}, 0) = 0 AND CompanyID = {1}) OR CompanyID IS NULL) OR BranchID = {0} | [LeadDocument.BranchID] | [LeadDocument.CompanyID]", sampleResultObject);
40
40
  // const devExpressFilter = parseFilterString("FromDate <= '{TransferOutwardDocument.DocDate}' ", sampleResultObject, "TransferOutwardDocument", "789");
41
- // const devExpressFilter = parseFilterString("(RS2ID in ({SaleOrderStatusStmtGlobalRpt.StateID}) Or ({SaleOrderStatusStmtGlobalRpt.StateID} =0)) And (RS3ID in (0,{SaleOrderStatusStmtGlobalRpt.RegionID}) Or {SaleOrderStatusStmtGlobalRpt.RegionID} =0 )", sampleResultObject,);
41
+ //const devExpressFilter = convertSQLToAst("(ISNULL(IsSubdealer,0) = {LeadDocument.AllowSubDealer})");
42
42
 
43
43
  // console.log("DevExpress Filter:", JSON.stringify(devExpressFilter, null, 2));