📄 ocilib.h
字号:
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
* Defauft 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 feched 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
);
/**
* @}
*/
/**
* @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 succes 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
*
*/
OCI_EXPORT unsigned int OCI_API OCI_ConnPoolGetTimeout
(
OCI_ConnPool *pool
);
/**
* @brief
* Set the idle connection timeout
*
* @param pool - Connection pool handle
* @param value - Timeout value
*
* @note
* Connections idle for more than this time value (in seconds) are terminated
*
* @note
* this call has no effect if pooling is internally implemented (client < 9i)
*
* @return
*
*/
OCI_EXPORT boolean OCI_API OCI_ConnPoolSetTimeout
(
OCI_ConnPool *pool,
unsigned int value
);
/**
* @brief
* Get the waiing mode used when no more connections are available from the
* pool
*
* @param pool - Connection pool handle
*
* @return
* - FALSE to wait for an available connection if the pool is saturated
* - TRUE to not wait for an available connection
*
*/
OCI_EXPORT boolean OCI_API OCI_ConnPoolGetlGetNoWait
(
OCI_ConnPool *pool
);
/**
* @brief
* Set the waiing mode used when no more connections are available from the
* pool
*
* @param pool - connection pool handle
* @param value - wait for connection
*
* @note
* Pass :
* - FALSE to wait for an available connection if the pool is saturated
* - TRUE to not wait for an available connection
*
* @return
*
*/
OCI_EXPORT boolean OCI_API OCI_ConnPoolSetNoWait
(
OCI_ConnPool *pool,
boolean value
);
/**
* @brief
* Return the current number of busy connections
*
* @param pool - Connection pool handle
*
*/
OCI_EXPORT unsigned int OCI_API OCI_ConnPoolGetBusyCount
(
OCI_ConnPool *pool
);
/**
* @brief
* Return the current number of opened connections
*
* @param pool - Connection pool handle
*
*/
OCI_EXPORT unsigned int OCI_API OCI_ConnPoolGetOpenedCount
(
OCI_ConnPool *pool
);
/**
* @brief
* Return the minimum number of connections that can be opened to the database
*
* @param pool - Connection pool handle
*
*/
OCI_EXPORT unsigned int OCI_API OCI_ConnPoolGetMin
(
OCI_ConnPool *pool
);
/**
* @brief
* Return the maximum number of connections that can be opened to the database
*
* @param pool - Connection pool handle
*
*/
OCI_EXPORT unsigned int OCI_API OCI_ConnPoolGetMax
(
OCI_ConnPool *pool
);
/**
* @brief
* Return the increment for connections to be opened to the database when the
* pool is not full
*
* @param pool - Connection pool handle
*
*/
OCI_EXPORT unsigned int OCI_API OCI_ConnPoolGetIncrement
(
OCI_ConnPool *pool
);
/**
* @}
*/
/**
* @}
*/
/**
* @defgroup g_transac Managing transactions
* @{
*
* OCILIB supports local and global transactions.
*
* Local transactions are implicit within connection objects and there is no
* specific call or programming step for using it.
*
* In order to control changes made in the database :
*
* - OCI_Commit() validates current pending modifications
* - OCI_Rollback() discards current pending modifications
*
* OCILIB supports a feature called 'AutoCommit' that performs an implicit and
* automatic commit call after every execute call
*
* @note
* Those actions are executed within a connection context and not directly to
* a transaction.
*
* @warning
* Global transactions are optionnal and are designed for distributed or global
* transaction environments.
*
* OCILIB supports them by :
*
* - Creating/Destroying explicitly a transaction object
* - Starting/Stopping/Resuming explicitly the transaction
* - Preparing the transaction for specific calls
*
*/
/**
* @brief
* Commit current pending changes
*
* @param con - Connection handle
*
* @return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -