Fluent SQL
Fluent SQL is a Delphi library (an extension of VDB)
for writing SQL statements in Delphi (or MiniCalc) with a
fluent API.
In Sage, the [FluentSQL] tag controls whether
Fluent SQL members (methods, properties, and certain global
identifiers) are highlighted specially.
By default, this feature is disabled, to avoid false positives
in code samples that have nothing to do with Fluent SQL statements.
For example, consider this Delphi code sample…
[.pas]
Query := ReadOnlyDB.RunReader(VDB
.Select(t.trd_nbr)
.Select(t.amt)
.From(t.trd)
.Where(t.qty > 100)
.OrderBy(t.amt)
);
[end]
The above produces the following highlighting, by default…
Query := ReadOnlyDB.RunReader(VDB
.Select(t.trd_nbr)
.Select(t.amt)
.From(t.trd)
.Where(t.qty > 100)
.OrderBy(t.amt)
);
To highlight the Fluent SQL members in this Delphi example,
we can use the [FluentSQL] tag…
[FluentSQL on]
[.pas]
Query := ReadOnlyDB.RunReader(VDB
.Select(t.trd_nbr)
.Select(t.amt)
.From(t.trd)
.Where(t.qty > 100)
.OrderBy(t.amt)
);
[end]
[end]
The above produces the following highlighting, by default…
Query := ReadOnlyDB.RunReader(VDB
.Select(t.trd_nbr)
.Select(t.amt)
.From(t.trd)
.Where(t.qty > 100)
.OrderBy(t.amt)
);
The [FluentSQL] tag takes a single argument:
either on or off. This setting lasts until the matching
[end] tag.
As mentioned above, the FluentSQL mode is off initially,
to avoid false positives in code unrelated to Fluent SQL.
For example…
Dest.Value := Info.Create(Src.Value(Data.Text));
Above, the members Value, Create, and Text are all
highlighted as Fluent SQL members, which can be rather
distracting when not relevant.
Sage offers a secondary way to indicate whether to highlight
Fluent SQL members: using a language name ending with the
suffixes "SQL" or "NoSQL".
For example, when the [FluentSQL]
setting is off, you can highlight single code sample
with Fluent SQL members using one of these languages:
- [.DelphiSQL]
- [.DSConfigSQL]
- [.MiniCalcSQL]
- [.DelphiNoSQL]
- [.DSConfigNoSQL]
- [.MiniCalcNoSQL]
⏱ Last Modified: 10/24 10:44:32 am