Skip to main content

GetConfig

procedure GetConfig(const aDataSet: TvxClientDataSet;
const aSQL: string);

Example

procedure ScriptEvent(var Value: variant);
begin
GetConfig(Data,
'select SettingName, SettingValue from ExampleConfiguration where Enabled = 1');
Value := Data.RecordCount;
end;

Usage

GetConfig opens SQL into a client dataset using the Velox configuration database connection.

Parameters

NameTypeDescription
aDataSetTvxClientDataSet, const referenceExisting mutable dataset to close, clear, bind to SQLC and open.
aSQLstring, constQuery text. SQL parameter recognition is disabled.

Returns

No status value. On success, aDataSet.Active is True and exposes the query cursor. Zero rows is still a successful open.

Security and safety

With ParamCheck := False, concatenated input is not parameterised. Avoid untrusted values and secrets in SQL. Opening is synchronous and unbounded queries can consume time and memory. Do not rebind the same context-owned dataset concurrently.

Additional Technical Info

GetConfig closes and rebinds a supplied client dataset, then opens SQL on Velox's configuration database connection (gSystemConnection.SQLC). It is intended for configuration-side reads, not for Velox Data or map source/destination connections.

The dataset/table names are fictional. The example is source-reviewed and was not executed. Configuration data can be sensitive; query only data the script is authorised to use.

Implementation

The method sets Active := False, SQLDataSet.ParamCheck := False, clears FieldDefs, assigns SQLConnection := gSystemConnection.SQLC, assigns CommandText, logs the SQL and sets Active := True.

Side effects

The caller's previous cursor, fields, pending edits, command and connection are discarded. The full SQL is logged. The resulting dataset remains a live cursor on the shared configuration connection; no independent data copy is returned.

Errors and ambiguity

Every exception is caught and logged as an error reading data with GetConfig, including script and SQL context. Nothing is re-raised and no Boolean is returned. After failure the dataset has already been closed and cleared and may be partly rebound; check Active and logs rather than assuming the old content remains.

Related entries

External references

Created 2026-07-15