📄 ocilib.h
字号:
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 waiting 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 waiting 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 'Auto Commit' 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 optional 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
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_Commit
(
OCI_Connection *con
);
/**
* @brief
* Cancel current pending changes
*
* @param con - Connection handle
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_Rollback
(
OCI_Connection *con
);
/**
* @brief
* Enable / disable auto commit mode
*
* The auto commit mode allows commit changes after every executed SQL order
*
* @param con - Connection handle
* @param enable - Enable (TRUE) or disable (FALSE)
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_SetAutoCommit
(
OCI_Connection *con,
boolean enable
);
/**
* @brief
* Get current auto commit mode status
*
* @param con - Connection handle
*
* @return
* TRUE if auto commit mode is activated otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_GetAutoCommit
(
OCI_Connection *con
);
/**
* @brief
* Create a new global transaction or a serializable/read-only local transaction
*
* @param con - Connection handle
* @param timeout - Time that a transaction stays inactive after being stopped
* @param mode - Connection mode
* @param pxid - pointer to a global transaction identifier stucture
*
*
* @note
* The parameter 'mode' can be one of the following values :
*
* - Global transactions :
* - OCI_TRS_NEW : By default starts a new, tightly coupled and
* migratable branch.
* - OCI_TRS_TIGHT : explicitly specifies a tightly coupled branch
* - OCI_TRS_LOOSE : specifies a loosely coupled branch
*
* - Global and local transactions :
* - OCI_TRS_READONLY - start a read-only transaction
* - OCI_TRS_READWRITE - start a read-write transaction
* - OCI_TRS_SERIALIZABLE : start a serializable transaction
*
* @note
* For local transaction :
* - pass a NULL value for pxid
*
*/
OCI_EXPORT OCI_Transaction * OCI_API OCI_TransactionCreate
(
OCI_Connection *con,
unsigned int timeout,
unsigned int mode,
OCI_XID *pxid
);
/**
* @brief
* Free current transaction
*
* @param trans - Connection handle
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_TransactionFree
(
OCI_Transaction * trans
);
/**
* @brief
* Start global transaction
*
* @param trans - Connection handle
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_TransactionStart
(
OCI_Transaction * trans
);
/**
* @brief
* Stop current global transaction
*
* @param trans - Connection handle
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_TransactionStop
(
OCI_Transaction * trans
);
/**
* @brief
* Resume a stoppped global transaction
*
* @param trans - Global transaction handle
*
* @return
* TRUE on success otherwise FALSE
*/
OCI_EXPORT boolean OCI_API OCI_TransactionResume
(
OCI_Transaction * trans
);
/**
* @brief
* Prepare a global transaction validation
*
* @param trans - Global transaction handle
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_TransactionPrepare
(
OCI_Transaction * trans
);
/**
* @brief
* Cancel the prepared global transaction validation
*
* @param trans - Global transaction handle
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_TransactionForget
(
OCI_Transaction * trans
);
/**
* @brief
* Return global transaction mode.
*
* @note:
* see OCI_TransactionCreate() for possible values
*
* @param trans - Global transaction handle
*
* @return
* Transaction mode or OCI_UNKNOW if trans is NULL
*
*/
OCI_EXPORT unsigned int OCI_API OCI_TransactionGetMode
(
OCI_Transaction * trans
);
/**
* @brief
* Return global transaction Timeout
*
* @param trans - Global transaction handle
*
* @return
* Transaction timeout or 0 if trans is NULL
*
*/
OCI_EXPORT unsigned int OCI_API OCI_TransactionGetTimeout
(
OCI_Transaction * trans
);
/**
* @}
*/
/**
* @defgroup g_exec Executing statements
* @{
*
* Executing SQL statements or PL/SQL blocks is really simple with OCILIB.
*
* First, call OCI_StatementCreate() to allocate a statement handle. Then :
*
* - Parse the SQL with OCI_Prepare()
* - Execute it with OCI_Execute()
*
* These two steps can be done together by calling OCI_ExecuteStmt() that
* parses and executes in one go.
*
* To find out if the statement has affected any rows, call OCI_GetAffectedRows()
*
* Finally, release the statement and its resources with OCI_StatementFree()
*
* @note
* A statement can be parsed once and executed as many times as needed (see
* Binding variables section)
*
* @note
* A OCI_Statement can be used to prepare and/or execute different SQL and PL/SQL
* statements as many times as needed.
* For example, if the SQL processing of an application is sequential, only
* one statement handle is required
*
* @note
* OCILIB supports nested levels of SQL statement processing.
* An application can loop through the resultset of the statement handle A,
* executing statement B and fetching statement C at every loop, and so on ...
*
* @par Example
* @include exec.c
*
*/
/**
* @brief
* Create a statement object and return its handle
*
* @param con - Connection handle
*
* @return
* A statement handle on success otherwise NULL
*
*/
OCI_EXPORT OCI_Statement * OCI_API OCI_StatementCreate
(
OCI_Connection *con
);
/**
* @brief
* Free a statement and all resources associated to it (resultsets, ....)
*
* @param stmt - Connection handle
*
* @return
* TRUE on success otherwise FALSE
*
*/
OCI_EXPORT boolean OCI_API OCI_StatementFree
(
OCI_Statement *stmt
);
/**
* @brief
* Prepare a SQL statement or PL/SQL block.
*
* @param stmt - Statement handle
* @param sql - SQL order or PL/SQL block
*
* @note
* With version 1.3.0 and above, do not call this function for fetched
* statement handle (REF cursors)
*
* @return
* TRUE on success otherwise FALSE
*/
OCI_EXPORT boolean OCI_API OCI_Prepare
(
OCI_Statement *stmt,
const mtext *sql
);
/**
* @brief
* Execute a prepared SQL statement or PL/SQL block.
*
* @param stmt - Statement handle
*
* @return
* TRUE on success otherwise FALSE
*/
OCI_EXPORT boolean OCI_API OCI_Execute
(
OCI_Statement *stmt
);
/**
* @brief
* Parse and execute a SQL statement or PL/SQL block.
*
* @param stmt - Statement handle
* @param sql - SQL order - PL/SQL block
*
* @return
* TRUE on success otherwise FALSE
*/
OCI_EXPORT boolean OCI_API OCI_ExecuteStmt
(
OCI_Statement *stmt,
const mtext *sql
);
/**
* @brief
* Return the last SQL or PL/SQL statement parsed by the statement
*
* @param stmt - Statement handle
*
*/
OCI_EXPORT const mtext * OCI_API OCI_GetSql
(
OCI_Statement *stmt
);
/**
* @brief
* Return the error position in the SQL statement where the error occurred in
* case of SQL parsing error
*
* @param stmt - Statement handle
*
* @note
* Positions start at 1.
*
*/
OCI_EXPORT unsigned i
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -