📄 ocilib.h
字号:
OCI_EXPORT OCI_Statement * OCI_API OCI_ErrorGetStatement
(
OCI_Error *err
);
/**
* @}
*/
/**
* @defgroup g_connect Connecting to Database
* @{
*
* Connecting to a database server is done with one call to
* OCI_ConnectionCreate().
*
* OCI_ConnectionFree() closes the established connection.
*
* Connection properties are accessible through a set of functions
*
* @par Example
* @include conn.c
*
*/
/**
* @brief
* Create a physical connection to an Oracle database server
*
* @param db - Oracle Service Name
* @param user - Oracle User name
* @param pwd - Oracle User password
* @param mode - Session mode
*
* Possible values for parameter mode :
* - OCI_SESSION_DEFAULT
* - OCI_SESSION_SYSDBA
* - OCI_SESSION_SYSOPER
*
* @note
* External credentials are supported by supplying a null value for the 'user'
* and 'pwd' parameters
*
* @note
* On success, a transaction is automatically created and started
*
* @return
* Connection handle on success or NULL on failure
*
*/
OCI_EXPORT OCI_Connection * OCI_API OCI_ConnectionCreate
(
const mtext *db,
const mtext *user,
const mtext *pwd,
unsigned int mode
);
/**
* @brief
* Close a physical connection to an Oracle database server
*
* @param con - Connection handle
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_ConnectionFree
(
OCI_Connection *con
);
/**
* @brief
* Returns TRUE is the given connection is still connected otherwise FALSE
*
* @param con - Connection handle
*
*/
OCI_EXPORT boolean OCI_API OCI_IsConnected
(
OCI_Connection *con
);
/**
* @brief
* Return the previously pointer to user data associated with the connection
*
* @param con - Connection handle
*
*/
OCI_EXPORT void * OCI_API OCI_GetUserData
(
OCI_Connection *con
);
/**
* @brief
* Associate to the given connection a pointer to user data
*
* @param con - Connection handle
* @param data - User data pointer
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_SetUserData
(
OCI_Connection *con,
void * data
);
/**
* @brief
* Return the name of the connected database/service name
*
* @param con - Connection handle
*
*/
OCI_EXPORT const mtext * OCI_API OCI_GetDatabase
(
OCI_Connection *con
);
/**
* @brief
* Return the current logged user name
*
* @param con - Connection handle
*
*/
OCI_EXPORT const mtext * OCI_API OCI_GetUserName
(
OCI_Connection *con
);
/**
* @brief
* Return the current logged user password
*
* @param con - Connection handle
*
*/
OCI_EXPORT const mtext * OCI_API OCI_GetPassword
(
OCI_Connection *con
);
/**
* @brief
* Change the password of the logged user
*
* @param con - Connection handle
* @param password - New password
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_SetPassword
(
OCI_Connection *con,
const mtext *password
);
/**
* @brief
* Return the current session mode
*
* @param con - Connection handle
*
* @note
* See OCI_ConnectionCreate() for possible values
*
*/
OCI_EXPORT unsigned int OCI_API OCI_GetSessionMode
(
OCI_Connection *con
);
/**
* @brief
* Return the connected database server version
*
* @param con - Connection handle
*
*/
OCI_EXPORT const mtext * OCI_API OCI_GetVersionServer
(
OCI_Connection *con
);
/**
* @brief
* Return the major version number of the connected database server
*
* @param con - Connection handle
*
* @return
* Version number or 0 on failure
*
*/
OCI_EXPORT unsigned int OCI_API OCI_GetServerMajorVersion
(
OCI_Connection *con
);
/**
* @brief
* Return the minor version number of the connected database server
*
* @param con - Connection handle
*
* @return
* Version number or 0 on failure
*
*/
OCI_EXPORT unsigned int OCI_API OCI_GetServerMinorVersion
(
OCI_Connection *con
);
/**
* @brief
* Return the revision version number of the connected database server
*
* @param con - Connection handle
*
* @return
* Version number or 0 on failure
*
*/
OCI_EXPORT unsigned int OCI_API OCI_GetServerRevisionVersion
(
OCI_Connection *con
);
/**
* @brief
* Set the date format for implicit string / date conversions
*
* @param con - Connection handle
* @param format - Date format
*
* @note
* Default format is :
* - 'YYYY-MM-DD'
*
* @note
* Possible values are the string date format supported by Oracle.
* See documentation of Oracle SQL to_date() function for more details
*
*/
OCI_EXPORT boolean OCI_API OCI_SetDefaultFormatDate
(
OCI_Connection *con,
const mtext *format
);
/**
* @brief
* Return the current date format for implicit string / date conversions
*
* @param con - Connection handle
*
* @note
* See OCI_SetFormatDate() for possible values
*
*/
OCI_EXPORT const mtext * OCI_API OCI_GetDefaultFormatDate
(
OCI_Connection *con
);
/**
* @brief
* Set the numeric format for implicit string / numeric conversions
*
* @param con - Connection handle
* @param format - Numeric format
*
* @note
* Possible values are the string numeric format supported by Oracle.
* See documentation of Oracle SQL to_number() function for more details
*
* @note
* Defauft format is :
* - 'FM99999999999999999999999999999999999990.999999999999999999999999'
*
* @warning
* If data fetched from a string column cannot be converted to a number value
* with the given format, an error will be raised
*
*/
OCI_EXPORT boolean OCI_API OCI_SetDefaultFormatNumeric
(
OCI_Connection *con,
const mtext *format
);
/**
* @brief
* Return the current numeric format for implicit string / numeric conversions
*
* @param con - Connection handle
*
* @note
* See OCI_SetFormatNumeric() for possible values
*
*/
OCI_EXPORT const mtext * OCI_API OCI_GetDefaultFormatNumeric
(
OCI_Connection *con
);
/**
* @brief
* Return the current transaction of the connection
*
* @param con - Connection handle
*
*/
OCI_EXPORT OCI_Transaction * OCI_API OCI_GetTransaction
(
OCI_Connection *con
);
/**
* @brief
* Return the current transaction attached to the connection
*
* @param con - Connection handle
* @param trans - Transaction handle to assign
*
* @note
* The current transaction is automatically stopped but the newly assigned
* is not started or resumed.
*
*/
OCI_EXPORT boolean OCI_API OCI_SetTransaction
(
OCI_Connection *con,
OCI_Transaction *trans
);
/**
* @brief
* Return the highest Oracle version is supported by the connection
*
* @param con - connection handle
*
* @note
* The highest supported version is the lower version between client and server:
*
* @note
* Returns one of the following values :
*
* - OCI_UNKNOWN
* - OCI_8
* - OCI_9
* - OCI_10
* - OCI_8
* - OCI_11
*
*/
OCI_EXPORT unsigned int OCI_API OCI_GetVersionConnection
(
OCI_Connection *con
);
/**
* @brief
* Set tracing information to the session of the given connection
*
* @param con - connection handle
* @param trace - trace type
* @param value - trace content
*
* Store current trace information to the given connection handle.
* These information:
*
* - is stored in the system view V$SESSION
* - can be retrieved from the connection property of an OCI_Error handle
*
* @note
* Possible values of parameter 'trace type' :
*
* - OCI_TRC_IDENTITY : Specifies the user defined identifier in the session.
* It's recorded in the column CLIENT_IDENTIFIER of the
* system view V$SESSION
* - OCI_TRC_MODULE : name of the current module in the client application.
* It's recorded in the column MODULE of the
* system view V$SESSION
* - OCI_TRC_ACTION : name of the current action within the current module.
* It's recorded in the column ACTION of the
* system view V$SESSION
* - OCI_TRC_DETAIL : Client application additional information.
* It's recorded in the column CLIENT_INFO of the
* system view V$SESSION
*
* @warning
* The system view V$SESSION is updated on Oracle versions >= 10g
*
* @warning
* Oracle limits the size of these traces content and thus OCILIB will truncate
* the given values if needed :
*
* - OCI_TRC_IDENTITY : 64 bytes
* - OCI_TRC_MODULE : 48 bytes
* - OCI_TRC_ACTION : 32 bytes
* - OCI_TRC_DETAIL : 64 bytes
*
*/
OCI_EXPORT boolean OCI_API OCI_SetTrace
(
OCI_Connection *con,
unsigned int trace,
const mtext *value
);
/**
* @brief
* Get the current trace for the trace type from the given connection.
*
* @param con - connection handle
* @param trace - trace type
*
* @note
* See OCI_SetTrace() for more details.
*
*/
OCI_EXPORT const mtext * OCI_API OCI_GetTrace
(
OCI_Connection *con,
unsigned int trace
);
/**
* @}
*/
/**
* @defgroup g_connpool Connection Pools
* @{
*
* OCILIB support the OCI features Connection pooling introduced in Oracle 9i.
*
* @note
* OCILIB implements its own pooling mechanism for Oracle 8i.
*
* @par Example
* @include pool.c
*
*/
/**
* @brief
* Create a Connection pool
*
* @param db - Oracle Service Name
* @param user - Oracle User name
* @param pwd - Oracle User password
* @param mode - Session mode
* @param min_con - minimum number of connections that can be opened.
* @param max_con - maximum number of connections that can be opened.
* @param incr_con - next increment for connections to be opened
*
* Possible values for parameter mode :
* - OCI_SESSION_DEFAULT
* - OCI_SESSION_SYSDBA
* - OCI_SESSION_SYSOPER
*
* @note
*
* @return
* Connection pool handle on success or NULL on failure
*
*/
OCI_EXPORT OCI_ConnPool * OCI_API OCI_ConnPoolCreate
(
const mtext *db,
const mtext *user,
const mtext *pwd,
unsigned int mode,
unsigned int min_con,
unsigned int max_con,
unsigned int incr_con
);
/**
* @brief
* Destroy a Connection pool object
*
* @param pool - Connection pool handle
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_ConnPoolFree
(
OCI_ConnPool *pool
);
/**
* @brief
* Get a connection from the pool
*
* @param pool - Connection pool handle
*
* @note
*
* @return
* Connection handle otherwise NULL on failure
*/
OCI_EXPORT OCI_Connection * OCI_API OCI_ConnPoolGetConnection
(
OCI_ConnPool *pool
);
/**
* @brief
* Get the idle connection timeout
*
* @param pool - Connection pool handle
*
* @note
* Connections idle for more than this time value (in seconds) are terminated
*
* @note
* Timeout is not available for internal pooling implementation (client < 9i)
*
* @return
*
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -