Skip to main content

AsSQLTrim

property AsSQLTrim: string read write;

Example

procedure ScriptEvent(var Value: Variant);
begin
Locals['Code'].AsString := ' NZ ';
Value := Locals['Code'].AsSQLTrim;
end;

Usage

AsSQLTrim trims the decrypted string before SQL quoting, but its setter uses the same lossy literal parser before trimming.

Additional Technical Info

The getter obtains decrypted AsString, trims leading/trailing spaces and control characters, then applies SafeSQL quoting/NUL removal/apostrophe escaping. It returns a quoted empty string for empty/Null text, not SQL NULL.

The setter uses Copy(Input, 2, Length(Input)-3), unescapes doubled apostrophes, trims the result and assigns through AsString/Value. Like AsSQL, a normally quoted literal loses its final data character as well as its closing quote. No quote syntax is validated.

Avoid the setter and do not treat the getter as parameter binding. Trimming can also be semantically significant for fixed business identifiers.

Official references: Delphi Trim, Free Pascal Trim, Delphi Copy, Free Pascal Copy.

Created 2026-07-15