SQLInfo
- Last UpdatedJul 18, 2023
- 2 minute read
Gets information about a database connection, recordset or query properties.
This function can be called in the foreground or background.
Syntax
SQLInfo(hGeneral, Type)
hGeneral:
The handle either to:
The DB connection object, returned from either SQLCreate or SQLConnect function. The handle identifies the DB connection object where details of the associated SQL connection are stored.
Or:
The recordset.
Or:
The query.
nType:
The type of information to get:
0 - The connection string.
1 - The current SQL query for connection handles and query handles or the source SQL query for recordset handles.
2 - The current database filename (only works with SQL device).
3 - No longer supported.
4 - No longer supported. Now returns an empty string and sets the SQL error to 'Invalid Type'.
5 - The DB connection object's state: Closed (The connection is closed), Open (The connection is open), Connecting (The connection object is connecting to the data source. For future release), Executing (The connection object is executing a command. For future release), Fetching (The connection object is retrieving data. For future release), Broken (The connection to the data source is broken. This can occur only after the connection has been opened. A connection in this state may be closed and then re-opened. For future release). An empty string means either error occurred or the handle is invalid.
6 - The handle to the connection if used on either recordset or query handle.
7 - Checks whether a new transaction can be opened. The function perform a check how many transaction levels have been already opened and returns TRUE if a new one can be opened, otherwise FALSE. The function doesn't check ability of the external DB to open transactions. The functions returns FALSE for recordset handles.
Note: There is no guarantee that the objects behind the connection handles still exist in the system.
Return Value
The information (as a string).
Related Functions
SQLCreate, SQLOpen, SQLClose, SQLDispose, SQLConnect, SQLDisconnect
Example
SQLInfo(1,2);