Unit: EgStrParser
type
TParseResult = record
InputType: TInputType;
ResultType: TResultType;
Values: TStringDynArray; // Normalised display values (locale-aware)
SQLValues: TStringDynArray; // SQL-safe literals
ParsedValue: string; // Human-readable summary
SQLExpression: string; // Ready SQL fragment: literal / IN / BETWEEN
ErrorCode: Integer; // 0 = OK; see ERR_* constants
end;
The record returned by every call to ParseInput and TEgStrParser.Parse,
and kept in TEgStrParser.LastResult.
InputType, ResultType and
ErrorCode are always set; the other fields depend on the
result (see below).
| Field | Type | Description |
|---|---|---|
ErrorCode |
Integer |
ERR_NONE (0) on success; an ERR_* constant
on failure. |
InputType |
TInputType |
The ValueType given to ParseInput. |
ParsedValue |
string |
The values joined into a readable summary. |
ResultType |
TResultType |
The shape of the input, or otInvalid. |
SQLExpression |
string |
The complete comparison fragment for a WHERE
clause. |
SQLValues |
TStringDynArray |
The SQL literal of each token. |
Values |
TStringDynArray |
The normalized, locale-aware value of each token. |
Values and SQLValues always have the same
length: one element for otEmpty and
otSingleValue, one per item for otList, two
for otRange. For otInvalid they hold the
tokens parsed before a validation error (range order,
opNotNull, opRequired); for the other errors
(format, ERR_LIST_SEPARATOR_CONFLICT,
ERR_INVALID_RANGESEP) they are empty (nil),
and so is ParsedValue.
R := ParseInput('1;2;3', itInteger);
// R.ResultType = otList
// R.Values = ['1', '2', '3']
// R.SQLValues = ['1', '2', '3']
// R.ParsedValue = '1 ; 2 ; 3'
// R.SQLExpression = 'IN (1, 2, 3)'
// R.ErrorCode = ERR_NONE