Unit: EgStrParserComp |
Inherits from: TComponent
type
TEgStrParser = class(TComponent)
Non-visual component that keeps an SQL dialect and a set of defaults
(options, range separator, operator) and calls ParseInput with them. It
is in the Easygate category of the Tool Palette and
works on VCL and FMX forms and data modules.
Set SqlDialect,
DefaultOptions,
DefaultRangeSep
and DefaultOperator
once in the Object Inspector, and call Parse from event
handlers. One component is usually enough for a form; use more when
parts of the form need different dialects or default operators.
The component passes its own SqlDialect to the full
overload of ParseInput and never reads or writes the global
default dialect of SetSQLDialect. It
never reads a control by itself: the caller passes the text.
When the component is dropped on a form, the IDE adds
EgStrParserComp to the uses clause, but not
EgStrParser. A unit that names TParseResult,
TInputType, otInvalid or another identifier of
EgStrParser must add that unit itself.
| Properties | Methods |
|---|---|
DefaultOperator |
Create |
DefaultOptions |
Parse |
DefaultRangeSep |
|
LastControl
(public) |
|
LastResult
(public) |
|
SqlDialect |
The members inherited from TComponent
(Name, Tag, Owner…) are not
described here.
Simultaneous calls on different instances are safe; on the same
instance they are not, because every call writes LastResult
and LastControl. See Thread safety.
// In the Object Inspector: EgParser1.SqlDialect = sqlElevateDB, DefaultOptions = [opTrim]
procedure TfrmSearch.edNameExit(Sender: TObject);
var
R: TParseResult;
begin
R := EgParser1.Parse(edName.Text, itString, sopLikeRight, Sender as TComponent);
if R.ResultType <> otInvalid then
FNameFilter := 'CustomerName ' + R.SQLExpression;
end;