The TSqlOperator value passed to ParseInput
controls the comparison operator written into
SQLExpression. It does not affect parsing or validation; it
only changes the shape of the SQL fragment produced.
| Operator | Single value | List | Range |
|---|---|---|---|
sopEqual |
= value |
IN (…) |
BETWEEN x AND y |
sopNotEqual |
<> value |
NOT IN (…) |
NOT BETWEEN x AND y |
sopGreaterEqual |
>= value |
IN (…) |
BETWEEN x AND y |
sopLessEqual |
<= value |
IN (…) |
BETWEEN x AND y |
sopGreater |
> value |
IN (…) |
BETWEEN x AND y |
sopLess |
< value |
IN (…) |
BETWEEN x AND y |
sopLikeRight |
LIKE 'value%' |
IN (…) |
BETWEEN x AND y |
sopLikeLeft |
LIKE '%value' |
IN (…) |
BETWEEN x AND y |
sopLikeBoth |
LIKE '%value%' |
IN (…) |
BETWEEN x AND y |
sopContainsAny |
ElevateDB: CONTAINS ANY 'words'; others:
LIKE '%w1%…%wN%' |
collapsed | BETWEEN x AND y |
sopContainsAll |
ElevateDB: CONTAINS ALL 'words'; others:
LIKE '%w1%…%wN%' |
collapsed | BETWEEN x AND y |
The default operator is sopEqual.
For lists (otList), only sopEqual and
sopNotEqual produce distinct output. All other operators
produce IN (…) — the same as sopEqual.
Input: "1;2;3", itInteger, sopGreaterEqual
SQLExpression: IN (1, 2, 3) -- not >= 1, 2, 3
Input: "1;2;3", itInteger, sopNotEqual
SQLExpression: NOT IN (1, 2, 3)
For ranges (otRange), only sopEqual and
sopNotEqual produce distinct output. All other operators
produce BETWEEN … AND ….
Input: "1~100", itInteger, sopLessEqual
SQLExpression: BETWEEN 1 AND 100 -- not <= 1~100
Input: "1~100", itInteger, sopNotEqual
SQLExpression: NOT BETWEEN 1 AND 100
When the single value token is NULL (empty input for
typed values, or itString with
opEmptyStringNull), sopNotEqual produces
IS NOT NULL and all other operators produce
IS NULL, regardless of the operator requested.
Input: "", itInteger, sopGreater
SQLExpression: IS NULL -- not > NULL
sopLikeRight, sopLikeLeft, and
sopLikeBoth are meaningful only for itString
single values. For all other types or result shapes they silently fall
back to sopEqual behavior.
The user value is always escaped before being embedded in the
pattern: \, %, and _ are prefixed
with \. For all dialects except sqlBDEParadox,
the clause ESCAPE '\' is appended to the expression. On
sqlBDEParadox the characters are still replaced but no
ESCAPE clause is emitted, because the BDE SQL layer has
unreliable support for it.
Input: "O'Brien", itString, sopLikeLeft, sqlElevateDB
SQLExpression: LIKE '%O''Brien' ESCAPE '\'
Input: "100%", itString, sopLikeBoth, sqlElevateDB
SQLExpression: LIKE '%100\%%' ESCAPE '\'
For lists and ranges with LIKE operators, the output is
IN (…) / BETWEEN … AND … — the same as
sopEqual.
sopContainsAny and sopContainsAll are
meaningful only for itString values. For all other types
they fall back to = value.
On sqlElevateDB, the native full-text predicates are
used directly. The engine treats %, _, and
\ as literals, so no escaping is applied to the
argument.
Input: "hello world", itString, sopContainsAny, sqlElevateDB
SQLExpression: CONTAINS ANY 'hello world'
Input: "hello world", itString, sopContainsAll, sqlElevateDB
SQLExpression: CONTAINS ALL 'hello world'
On all other dialects, sopContainsAny and
sopContainsAll fall back to LIKE '%value%'
with metacharacter escaping (same as sopLikeBoth).
When the input is a list, the tokens are collapsed
into a single argument rather than producing IN (…). Empty
tokens (including NULL and '') are excluded
from the collapsed argument.
On sqlElevateDB, the words are joined with a space into
a single CONTAINS argument:
Input: "hello;world", itString, sopContainsAny, sqlElevateDB
SQLExpression: CONTAINS ANY 'hello world'
On other dialects, the words are escaped and joined with
%:
Input: "hello;world", itString, sopContainsAny, sqlMySQL
SQLExpression: LIKE '%hello%world%' ESCAPE '\'
The order of words in the LIKE fallback is significant:
the pattern %hello%world% matches strings that contain
hello followed by world at any positions, but
not world followed by hello. The ElevateDB
native predicates are order-independent.
sopContainsAny and sopContainsAll produce
BETWEEN … AND … for ranges — the same as
sopEqual. Full-text search and range queries are orthogonal
concepts; use a list or single value for CONTAINS
operations.
When the input is empty and the type is not itString (or
itString with opEmptyStringNull),
sopNotEqual produces IS NOT NULL rather than
<> NULL.
Input: "", itDate, sopNotEqual
SQLExpression: IS NOT NULL
Input: "", itDate, sopEqual
SQLExpression: IS NULL