OCIEnvCreate
Description : You can call this function to create and initialize an environment handle.
Function syntax :
sword OCIEnvCreate ( OCIEnv **envhpp,
ub4 mode,
CONST dvoid *ctxp,
CONST dvoid (malocfp)
(dvoid *ctxp,
size_t size),
CONST dvoid (ralocfp)
(dvoid *ctxp,
dvoid *memptr,
size_t newsize),
CONST void (*mfreefp)
(dvoid *ctxp,
dvoid *memptr))
size_t xtramemsz,
dvoid **usrmempp );
Parameters :
| Parameter | Description |
|---|---|
| envhpp(OUT) | The pointer to the environment handle that is created. |
| mode(IN) | The mode of initialization. OBCI V1.2.0 supports OCI_DEFAULT (the default mode) and OCI_THREADED (the multi-threaded mode). |
| ctxp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
| malocfp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
| ralocfp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
| mfreefp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
| xtramemsz(IN) | The amount of extra memory to be allocated. |
| usrmempp(OUT) | Returns the address of the extra memory allocated. |
Return value : OCI_SUCCESS if succeeded, OCI_ERROR if failed, and OCI_INVALID_HANDLE in the event of an invalid handle.
OCIEnvNlsCreate
Description : You can call this function to create and initialize an environment handle for OCI functions to work under. It is an enhanced version of the OCIEnvCreate() function.
Function prototype :
sword OCIEnvNlsCreate ( OCIEnv **envhpp,ub4 mode,void *ctxp,void *(*malocfp)(void *ctxp, size_t size),void *(*ralocfp)(void *ctxp, void *memptr, size_t newsize),void (*mfreefp)(void *ctxp, void *memptr),size_t xtramemsz,void **usrmempp,ub2 charset,ub2 ncharset );
Parameters :
| Parameter | Description |
|---|---|
| envp(OUT) | An environment handle. |
| mode(IN) | The mode of initialization. OBCI V1.2.0 only supports OCI_DEFAULT, which is the default mode. |
| ctxp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
| malocfp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
| ralocfp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
| mfreefp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
| xtramemsz(IN) | The amount of extra memory to be allocated. |
| usrmempp(OUT) | Returns the address of the extra memory allocated. |
| charset(IN) | The client-end character set for the current environment handle. If the value is 0, the NLS_LANG setting is used. OCI_UTF16ID is a valid setting and is used by the metadata and CHAR data. |
| ncharset(IN) | The national character set at the client end for the current environment handle. If the value is 0, the NLS_ NCHAR setting is used. OCI_UTF16ID is a valid setting and is used by the NCHAR data. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
OCIEnvInit
Description : You can call this function to allocate and initialize an environment handle.
Function prototype :
sword OCIEnvInit ( OCIEnv **envhpp,
ub4 mode,
size_t xtramemsz,
dvoid **usrmempp );
Parameters:
| Parameter | Description |
|---|---|
| envp(OUT) | An environment handle. |
| mode(IN) | The mode of initialization. OBCI V1.2.0 only supports OCI_DEFAULT, which is the default mode. |
| xtramem_sz(IN) | The amount of extra memory to be allocated. |
| usrmempp(IN) | Returns the address of the extra memory allocated. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
OCIInitialize
Description : You can call this function to initialize the OCI application environment. In this function, OCI initializes internal global variables and loads some configuration information.
Function prototype :
sword OCIInitialize ( ub4 mode,
const void *ctxp,
const void *(*malocfp)
( void *ctxp,
size_t size ),
const void *(*ralocfp)
( void *ctxp,
void *memptr,
size_t newsize ),
const void (*mfreefp)
( void *ctxp,
void *memptr ));
Parameters :
| Parameter | Description |
|---|---|
| mode(IN) | The mode of initialization. OBCI V1.2.0 supports OCI_DEFAULT (the default mode) and OCI_THREADED (the multi-threaded mode). |
| ctxp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
| malocfp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
| ralocfp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
| mfreefp(IN) | A parameter reserved for compatibility. Ignore this parameter. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
OCILogoff
Description : You can call this function to disconnect a server session created by calling the OCILogon() function.
Function prototype :
sword OCILogoff (
OCISvcCtx *svchp
OCIError *errhp );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | Specifies the service context handle associated with the session that you want to disconnect. |
| errhp(IN/OUT) | An error handle. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
OCILogon
Description : You can call this function to log on to a specified database service with your username and password and initialize the related context handles.
Function prototype :
sword OCILogon ( OCIEnv *envhp,
OCIError *errhp,
OCISvcCtx **svchp,
CONST OraText *username,
ub4 uname_len,
CONST OraText *password,
ub4 passwd_len,
CONST OraText *dbname,
ub4 dbname_len );
Parameters :
| Parameter | Description |
|---|---|
| envhp(IN) | An environment handle. |
| errhp(IN/OUT) | An error handle. |
| svchp(IN/OUT) | A service context handle. |
| username(IN) | The logon username. |
| uname_len(IN) | The length of the logon username. |
| password(IN) | The logon password. |
| passwd_len(IN) | The length of the logon password. |
| dbname(IN) | The name of the database service to connect to. |
| dbname_len(IN) | The length of the database service name. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
OCIServerAttach
Description : You can call this function to attach a database server to a specified connection handle.
Function prototype :
sword OCIServerAttach ( OCIServer *srvhp,
OCIError *errhp,
CONST text *dblink,
sb4 dblink_len,
ub4 mode );
Parameters :
| Parameter | Description |
|---|---|
| srvhp(IN) | A server handle that must not be initialized. |
| errhp(IN/OUT) | An error handle. |
| dblink(IN) | The name of the database server to be associated. |
| dblink_len(IN) | The length of the database server name. |
| mode(IN) | The mode of attachment. OBCI V1.2.0 only supports OCI_DEFAULT. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
OCIServerDetach
Description : You can call this function to disassociate a connection handle from a database server.
Function prototype :
sword OCIServerDetach ( OCIServer *srvhp,
OCIError *errhp,
ub4 mode );
Parameters :
| Parameter | Description |
|---|---|
| srvhp(IN) | A server handle that is initialized. |
| errhp(IN/OUT) | An error handle. |
| mode(IN) | The mode of attachment. OBCI V1.2.0 only supports OCI_DEFAULT, which is the default mode. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
OCISessionBegin
Description : You can call this function on the specified service context handle to create a session for the specified database server with your logon credentials.
Function prototype :
sword OCISessionBegin ( OCISvcCtx *svchp,
OCIError *errhp,
OCISession *usrhp,
ub4 credt,
ub4 mode );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | A handle to the service context on which you want to create the session. |
| errhp(IN/OUT) | An error handle. |
| usrhp(IN) | A handle to the user session context. |
| credt(IN) | The mode of logon. OBCI V1.2.0 only supports OCI_CRED_RDBMS, which enables you to create a session for a database server with your username and password. |
| mode(IN) | The mode of operation. OBCI V1.2.0 only supports OCI_DEFAULT, which is the default mode. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
OCISessionEnd
Description : You can call this function to disconnect the session with the database server that you created by calling the OCISessionBegin() function on the specified service context handle.
Function prototype :
sword OCISessionEnd ( OCISvcCtx *svchp,
OCIError *errhp,
OCISession *usrhp,
ub4 mode );
Parameters :
| Parameter | Description |
|---|---|
| svchp(IN) | Specifies the service context handle to be disconnected. |
| errhp(IN/OUT) | An error handle. |
| usrhp(IN) | A handle to the user session context. |
| mode(IN) | The mode of operation. OBCI V1.2.0 only supports OCI_DEFAULT, which is the default mode. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.
OCIPing
Description : You can call this function to verify that a session and service are active. It succeeds only when the service is active and the session exists.
Function prototype :
sword OCIPing (
OCISvcCtx* svchp,
OCIError* errhp,
ub4 mode)
Parameters :
| Parameter | Description |
|---|---|
| svchp (IN) | A handle to the service context or session. |
| errhp (IN/OUT) | An error handle. |
| mode (IN) | A time string. |
Return value : OCI_SUCCESS if succeeded, or OCI_ERROR if failed.