Type: TInputType |
Unit: EgStrParser
Accepts any text. The input is not validated against a format: any string is a valid value.
A token that begins with a single quote is a quoted string. The
surrounding quotes are removed before the value is stored in Values. A single
quote inside a quoted string is written doubled.
Input: 'O''Brien' -> Values[0]: O'Brien
SQLValues[0]: 'O''Brien'
The same rule applies to quoted list items and quoted range bounds.
Before 2.1.0 the doubled quote was kept in Values
(O''Brien) and escaped again in SQL
('O''''Brien').
Unquoted tokens are stored as typed, including a doubled quote typed
by the user (it''s stays it''s). Leading and
trailing spaces are kept unless opTrim is set.
Both , and ; separate list items. A comma
inside a quoted region is not a separator.
Input: 'smith, jones' -> otSingleValue (the comma is inside quotes)
Input: smith, jones -> otList (the comma is outside quotes)
Input: smith; jones -> otList
The range separator (~ by default) splits the input into
two bounds. Quoted values on either side are unquoted after the
split.
Input: alpha~omega -> otRange, Values: ['alpha', 'omega']
Input: 'alpha'~'omega' -> otRange, Values: ['alpha', 'omega']
String ranges are not order-checked: ERR_INVALID_RANGE
is never returned for itString.
Each token is enclosed in single quotes, and single quotes inside it
are doubled. On sqlMySQL backslashes are doubled as well
(see SQL dialects).
Values[0]: O'Brien -> SQLValues[0]: 'O''Brien'
When the operator is sopContainsAny or
sopContainsAll and the input is a list, the tokens are
collapsed into a single argument instead of IN (...). On
ElevateDB the argument goes to the native CONTAINS ANY /
CONTAINS ALL predicate. On the other dialects the words are
joined with % into a LIKE pattern. Empty
tokens (including empty quoted strings '' and tokens that
became NULL through opEmptyStringNull) are
left out of the argument: they would add double spaces to the ElevateDB
argument or %% to the LIKE pattern.
Input: hello;;world + sopContainsAny, sqlElevateDB
SQLExpression: CONTAINS ANY 'hello world' (empty middle token left out)
Input: hello;;world + sopContainsAny, sqlMySQL
SQLExpression: LIKE '%hello%world%' ESCAPE '\\'
Input: hello;;world + sopContainsAny, sqlBDEParadox
SQLExpression: LIKE '%hello%world%' (no ESCAPE clause)
SQLValues
still holds the result of every token (the middle token is
'' or NULL there); only SQLExpression
leaves the empty tokens out. See Operators.
opTrim removes leading
and trailing spaces from each token. For itString it is the
only way to remove them.opEmptyStringNull
turns empty tokens (including '') into NULL
instead of ''.opUpperCase and
opLowerCase convert
the values to upper or lower case, in Values and inside the
quotes of SQLValues.opRequired and opNotNull work as for the
other types.