Skip to main content

ExecSQLStatementSource

function ExecSQLStatementSource(const aSQL: string;
aDBIndex: integer): boolean;

Example

procedure ScriptEvent(var Value: variant);
begin
Value := ExecSQLStatementSource(
'update ExampleInbound set ReadFlag = 1 where MessageID = 1001', 1);
end;

Usage

ExecSQLStatementSource executes SQL on a selected source database connection.

Parameters

NameTypeDescription
aSQLstring, constComplete source SQL. Parameter recognition is disabled.
aDBIndexintegerZero-based source-list position. The script declaration requires it.

Returns

True when direct execution returns normally; False for an SQL exception caught after query creation. Indexed connection lookup and query creation happen before the protected query body and can propagate. Rows affected are discarded and transaction completion is not reported.

Security and safety

Parameter binding is unavailable through this helper. Do not concatenate untrusted input, expose credentials in SQL, or modify a source system without explicit authorisation. Execution is synchronous and may wait on the remote database.

Additional Technical Info

ExecSQLStatementSource executes non-query SQL on a source connection selected by zero-based index. Unlike the destination form, its current implementation does not explicitly start a Velox transaction.

The example is fictional, source-reviewed and was not executed.

Implementation

The function selects SourceDBCons[aDBIndex].SQLDATA, creates a query, sets ParamCheck := False, appends and logs aSQL, calls ExecSQL(True), and frees the query. A declared local TField variable is unused; it has no runtime effect.

There is no vxStartTransaction, commit or rollback in this source path. Autocommit or transaction participation depends on existing connection state and driver configuration.

Side effects and errors

The statement may change the external source system and is logged in full. Lookup/creation exceptions can propagate; later query exceptions are logged and suppressed into False. No explicit transaction recovery occurs.

Related entries

External references

Created 2026-07-15