Sage
Welcome to Sage
Volume (53%) Hide Volume
Topics
Fluent SQL
Fluent SQL is a Delphi library (an extension of VDB) for writing SQL statements in Delphi (or MiniCalc) with a fluent API.

The FluentSQL Tag

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.

Tip

Within a [FluentSQL][end] block, you can include other files, which will inherit the [FluentSQL] setting from the parent file.


False Positives

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.

Explicit Language Names

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]

Similarly, when the [FluentSQL] setting is on, you can highlight single code sample without Fluent SQL members using one of these languages:
  • [.DelphiNoSQL]
  • [.DSConfigNoSQL]
  • [.MiniCalcNoSQL]

See Also

Related Items

  • Code samples.

  • The [box] tag encloses content in a box (similar to block code samples), but the content may have Sage markup.

  • The [indent] tag indents content, but without a visible box or border.


Last Modified: 10/24 10:44:32 am
In this article (top)  View article's Sage markup
10/24 10:44:32 am