GetDataFromDest
procedure GetDataFromDest(const aDataSet: TvxClientDataSet;
const aSQL: string);
Example
procedure ScriptEvent(var Value: variant);
begin
GetDataFromDest(Data,
'select DocumentNo, Exported from ExampleTarget where Exported = 0');
Value := Data.RecordCount;
end;
Usage
GetDataFromDest opens SQL into a client dataset using the primary destination database connection.
Parameters
| Name | Type | Description |
|---|---|---|
aDataSet | TvxClientDataSet | Existing mutable dataset to rebind and open. |
aSQL | string, const | Query SQL for destination index 0; no parameter binding. |
Returns
No status. On success the same dataset is active; zero rows is a valid cursor.
Errors
Invalid destination state and SQL/open exceptions are caught and logged, not propagated. The dataset has already been reset and may remain inactive or partly rebound. Inspect logs because the procedure has no result.
Security and safety
SQL is direct and fully logged; never concatenate untrusted values. Opening is synchronous, potentially large, and can observe transaction-dependent destination state. Do not concurrently mutate the context-owned dataset or connection.
Additional Technical Info
GetDataFromDest opens SQL on the active map's primary destination connection into an existing client dataset. It is an exact wrapper for GetDataSetFromDest(aDataSet, aSQL, 0).
The example is fictional, source-reviewed and was not executed.
Implementation and side effects
The terminal method closes the dataset, disables ParamCheck, clears FieldDefs, assigns FDest.DBCons[0].DBCon.SQLDATA, sets/logs the command and opens it. Previous fields, cursor and edits are lost. It does not explicitly start or complete a transaction.
Related entries
GetDataSetFromDestselects a destination index.GetDataFromSourcetargets source index0.
External references
- Embarcadero
Data.DB.TDataSet.Active- cursor opening operation used by the terminal method. - Free Pascal
TDataSet.Active- compatible high-level state reference.