Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-552

Support BETWEEN and NOT BETWEEN in WHERE clause of SQL language and abstract query model

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 0.7
    • 0.6
    • Graph (2.x), Query, Search
    • None
    • Low

      Our search/query implementation will perform much better when it can detect a range of values in a criteria. Currently, ranges can only be specified using the form "WHERE ... <dynamicOperand> <operator1> <staticOperand1> ... AND <dynamicOperand> <operator2> <staticOperand2> ..." For example:

      WHERE ... DEPTH(myType) >= 3 AND DEPTH(myType) <=6

      SQL already has a BETWEEN operator (and corresponding NOT BETWEEN operator) that makes this not only more concise but also more easily understandable and obvious about the intent:

      WHERE ... DEPTH(myType) BETWEEN 3 and 6

      This concept would also have to be added to the abstract query model, and in particular as a subclass of Constraint that has a DynamicOperand and two StaticOperand values. And by adding this specialization of Constraint, we can add an optimizer rule that looks for ANDed constraints that represent a range on a DynamicOperand, and rewrite the constraints as a BETWEEN (or NOT BETWEEN).

      Note that a NOT BETWEEN would simply wrap a BetweenCriteria with a Not.

              rhauch Randall Hauch (Inactive)
              rhauch Randall Hauch (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: