AdsGetHandleType
Returns the type of an ADS handle (table, connection, statement, etc.).
Syntax
UNSIGNED32 AdsGetHandleType(ADSHANDLE h, UNSIGNED16 *pusType);
Parameters
| Parameter | Type | Description |
|---|---|---|
h |
ADSHANDLE |
Any valid ADS handle. |
pusType |
UNSIGNED16* |
Output — handle type constant. |
Return Value
AE_SUCCESS (0) on success.
Handle Type Constants
| Constant | Value | Description |
|---|---|---|
ADS_NONE |
0 | Unknown / invalid handle. |
ADS_TABLE |
1 | Table handle (local, remote, or backend). |
ADS_STATEMENT |
2 | SQL statement handle. |
ADS_CURSOR |
4 | SQL cursor handle. |
ADS_DATABASE_CONNECTION |
6 | Database connection handle. |
ADS_SYS_ADMIN_CONNECTION |
7 | System admin connection. |
Description
AdsGetHandleType queries the handle registry’s kind_of()
method to determine the type of any ADS handle. It correctly
distinguishes between tables, connections, statements, and
indexes across all backends (local, remote, SQLite, PostgreSQL,
MariaDB, MSSQL, ODBC, Firebird).
This replaces the previous stub that always returned ADS_TABLE.
Example
ADSHANDLE h;
UNSIGNED16 hType = 0;
AdsConnect60("tcp://server:6247", NULL, NULL, NULL, 0, &h);
AdsGetHandleType(h, &hType);
if (hType == ADS_DATABASE_CONNECTION)
printf("Handle is a connection\n");
AdsDisconnect(h);