|
saConnectionHandles *NativeHandles();
Returns a set of connection related handles of native DBMS
client API.
Return value
A pointer to a base class saConnectionHandles
from which a family of DBMS implementation-specific classes are derived.
Remarks
You have to use native API handles when you want to call DBMS
specific API functions which are not directly supported by the Library.
API functions usually need to receive one or more active handles as a
parameter(s). NativeHandles method returns a pointer
to the set of native API connection related handles.
To use API handles directly you have to downcast saConnectionHandles
pointer to the appropriate type and use its implementation-specific
members. If you need to use command related handles
see SACommand::NativeHandles
method.
See DBMS specific notes section to know what
type cast you have to make and what additional header file you have to
include to work with specific DBMS client API. Note that for some DBMS
using appropriate type casting depends on an API version (that
generally mean that you have to explicitly check client version before
casting, see ClientVersion
method).
To get more information about DBMS API functions and handles
see this DBMS specific documentation.
Please be aware of the
complications associated with making direct API calls, as the internal
logic of the SQLAPI++ Library is not used. Besides, making direct API
calls reduces an application's portability.
DBMS specific notes
|
DBMS client
|
Type casting
|
|
Oracle 8 (OCI8)
|
Cast the result
to class ora8ConnectionHandles:
#include
<oraAPI.h>
saConnectionHandles *pResult =
con.NativeHandles();
ora8ConnectionHandles *p_ora8CH =
(ora8ConnectionHandles *)pResult;
Available handles:
- OCIEnv *m_pOCIEnv;
- OCIError *m_pOCIError;
- OCISvcCtx *m_pOCISvcCtx;
- OCIServer *m_pOCIServer;
- OCISession
*m_pOCISession;
|
|
Oracle 7 (OCI7)
|
Cast the result
to class ora7ConnectionHandles:
#include
<ora7API.h>
saConnectionHandles *pResult =
con.NativeHandles();
ora7ConnectionHandles *p_ora7CH =
(ora7ConnectionHandles *)pResult;
Available handles:
- Lda_Def
m_lda;
- ub1 m_hda[512];
|
|
SQL Server (OLE DB)
|
Cast the result
to class ssOleDbConnectionHandles:
#include <ssOleDbAPI.h>
saConnectionHandles
*pResult = con.NativeHandles();
ssOleDbConnectionHandles *p_ssOleDbCH =
(ssOleDbConnectionHandles *)pResult;
Available handles:
- IDBInitialize
*pIDBInitialize;
- IDBCreateCommand
*pIDBCreateCommand;
- ITransactionLocal
*pITransactionLocal;
|
|
SQL Server
(DB-Library)
|
Cast the result
to class ssConnectionHandles:
#include <ss6API.h>
saConnectionHandles
*pResult = con.NativeHandles();
ssConnectionHandles *p_ssCH =
(ssConnectionHandles *)pResult;
Available handles:
|
| Sybase |
Cast the result
to class sybConnectionHandles:
#include <sybAPI.h>
saConnectionHandles
*pResult = con.NativeHandles();
sybConnectionHandles *p_ssCH =
(sybConnectionHandles *)pResult;
Available handles:
- CS_CONNECTION
*m_connection;
|
|
DB2
|
Cast the result
to class db2ConnectionHandles:
#include <db2API.h>
saConnectionHandles
*pResult = con.NativeHandles();
db2ConnectionHandles *p_ssCH =
(db2ConnectionHandles *)pResult;
Available handles:
- SQLHENV m_hevn;
- SQLHDBC m_hdbc;
|
|
Informix
|
Cast the result
to class infConnectionHandles:
#include <infAPI.h>
saConnectionHandles
*pResult = con.NativeHandles();
infConnectionHandles *p_ssCH =
(infConnectionHandles *)pResult;
Available handles:
- SQLHENV m_hevn;
- SQLHDBC m_hdbc;
|
|
InterBase
|
Cast the result
to class ibConnectionHandles:
#include <ibAPI.h>
saConnectionHandles
*pResult = con.NativeHandles();
ibConnectionHandles *p_ibCH =
(ibConnectionHandles *)pResult;
Available handles:
- isc_db_handle
m_db_handle;
- isc_tr_handle m_tr_handle;
|
|
SQLBase 6
|
Cast the result
to class sb6ConnectionHandles:
#include <sbAPI.h>
saConnectionHandles *pResult =
con.NativeHandles();
sb6ConnectionHandles *p_sb6CH =
(sb6ConnectionHandles *)pResult;
Available handles:
|
|
SQLBase 7
|
Cast the result
to class sb7ConnectionHandles:
#include <sbAPI.h>
saConnectionHandles
*pResult = con.NativeHandles();
sb7ConnectionHandles *p_sb7CH =
(sb7ConnectionHandles *)pResult;
Available handles:
- SQLTCUR m_cur;
- SQLTCON m_hCon;
|
|
MySQL
|
Cast the result
to class myConnectionHandles:
#include
<myAPI.h>
saConnectionHandles *pResult =
con.NativeHandles();
myConnectionHandles *p_myCH =
(myConnectionHandles *)pResult;
Available handles:
|
|
PostgreSQL
|
Cast the result
to class pgConnectionHandles:
#include
<pgAPI.h>
saConnectionHandles *pResult =
con.NativeHandles();
pgConnectionHandles *p_pgCH =
(pgConnectionHandles *)pResult;
Available handles:
|
|
ODBC
|
Cast the result
to class odbcConnectionHandles:
#include
<odbcAPI.h>
saConnectionHandles *pResult =
con.NativeHandles();
odbcConnectionHandles *p_odbcCH =
(odbcConnectionHandles *)pResult;
Available handles:
- SQLHENV m_hevn;
- SQLHDBC m_hdbc;
|
See also
SAConnection::ClientVersion,
SAConnection::NativeAPI,
SACommand::NativeHandles
Problems and Questions
If you haven't found the answer to your questions or have
some problems on using the Library, please, send e-mail to howto@sqlapi.com.
|