GetFileConFID
Function GetFileConFID( const aName : string) : TGuid
Example
procedure ScriptEvent(var Value: variant);
var
ModuleFID: TGuid;
begin
ModuleFID := GetFileConFID('Partner SFTP');
Value := GUIDToStringNoBraces(ModuleFID);
end;
Usage
GetFileConFID resolves a file connection module name to its live Velox system-configuration FID.
Parameters and result
| Item | Type | Description |
|---|---|---|
aName | string, const | File connection MODULENAME to find. The value is passed as a quoted SQL string literal after Velox escaping. |
| Result | TGuid | Matching FID. If the query returns no row, the function returns the all-zero EmptyGuid sentinel. |
Additional Technical Info
GetFileConFID looks up the file connection whose MODULENAME equals aName and returns its binary TGuid FID. It reads the current Velox system/configuration database; it is not a compile-time constant or an in-memory name map.
The module name in the example is fictional and source-reviewed only. The lookup was not executed by the documentation workflow.
Implementation
The scripting import registers the public function and binds it to the Velox FID helper. This wrapper calls GetFID with fixed table VX_FILECON. The shared helper:
- allocates a query from the live system/configuration connection;
- executes
select FID from VX_FILECON where MODULENAME = <escaped aName>; - returns the first row's GUID, or
EmptyGuidat end-of-file; and - closes and frees the query in a
finallyblock.
The fixed table name avoids the generic function's caller-controlled SQL identifier boundary.
Behaviour and edge cases
- Name matching, case sensitivity, trailing-space treatment and character collation are determined by the configuration database, not by Delphi string comparison.
- The shared
SQLStringconversion removes embedded#0characters before quoting. A supplied name containing NULs is therefore normalized before lookup. - The query has no
order by. If inconsistent data contains duplicate matching names, the returned row is database-dependent; do not use duplicate module names as an addressing scheme. - A missing module and a stored all-zero FID produce the same return value. Use
IsEmptyGuidto test the sentinel before using it as a foreign key or module reference. - The lookup observes the database state visible to the shared connection when the query executes. Renaming, deleting or replacing a module can change later results.
- The function does not validate that the resolved module is enabled, accessible for a later operation or suitable for the caller's business purpose.
Side effects and errors
This is a read-only query, but it consumes a database query/connection resource and can participate in database logging, locking or transaction visibility. Connection failure, SQL execution failure, permission/schema drift and an invalid stored GUID propagate as exceptions; only the no-row case becomes EmptyGuid.
Performance and concurrency
Each call creates and executes a query; there is no per-name cache. Avoid repeating it in a record-level loop when the name is stable—resolve once and reuse the TGuid. Query-object cleanup is deterministic. Concurrency, pooling and transaction isolation follow the shared Velox system connection.
Related entries
GetFIDis the generic table/name terminal and carries the dynamic-table security boundary.EmptyGuidreturns the same no-match sentinel.GUIDToStringNoBracesrenders the binary result for display or logging.SQLStringdocuments the lossy escaping applied to the name.