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:
OCILIB supports a feature called 'Auto Commit' that performs an implicit and automatic commit call after every execute call
OCILIB supports them by :
Functions | |
OCI_EXPORT boolean OCI_API | OCI_Commit (OCI_Connection *con) |
Commit current pending changes. | |
OCI_EXPORT boolean OCI_API | OCI_Rollback (OCI_Connection *con) |
Cancel current pending changes. | |
OCI_EXPORT boolean OCI_API | OCI_SetAutoCommit (OCI_Connection *con, boolean enable) |
Enable / disable auto commit mode. | |
OCI_EXPORT boolean OCI_API | OCI_GetAutoCommit (OCI_Connection *con) |
Get current auto commit mode status. | |
OCI_EXPORT OCI_Transaction *OCI_API | OCI_TransactionCreate (OCI_Connection *con, unsigned int timeout, unsigned int mode, OCI_XID *pxid) |
Create a new global transaction or a serializable/read-only local transaction. | |
OCI_EXPORT boolean OCI_API | OCI_TransactionFree (OCI_Transaction *trans) |
Free current transaction. | |
OCI_EXPORT boolean OCI_API | OCI_TransactionStart (OCI_Transaction *trans) |
Start global transaction. | |
OCI_EXPORT boolean OCI_API | OCI_TransactionStop (OCI_Transaction *trans) |
Stop current global transaction. | |
OCI_EXPORT boolean OCI_API | OCI_TransactionResume (OCI_Transaction *trans) |
Resume a stopped global transaction. | |
OCI_EXPORT boolean OCI_API | OCI_TransactionPrepare (OCI_Transaction *trans) |
Prepare a global transaction validation. | |
OCI_EXPORT boolean OCI_API | OCI_TransactionForget (OCI_Transaction *trans) |
Cancel the prepared global transaction validation. | |
OCI_EXPORT unsigned int OCI_API | OCI_TransactionGetMode (OCI_Transaction *trans) |
Return global transaction mode. | |
OCI_EXPORT unsigned int OCI_API | OCI_TransactionGetTimeout (OCI_Transaction *trans) |
Return global transaction Timeout. |
OCI_EXPORT boolean OCI_API OCI_Commit | ( | OCI_Connection * | con ) |
Commit current pending changes.
con | - Connection handle |
Definition at line 847 of file connection.c.
Referenced by OCI_TransactionStop().
OCI_EXPORT boolean OCI_API OCI_Rollback | ( | OCI_Connection * | con ) |
Cancel current pending changes.
con | - Connection handle |
Definition at line 872 of file connection.c.
Referenced by OCI_TransactionStop().
OCI_EXPORT boolean OCI_API OCI_SetAutoCommit | ( | OCI_Connection * | con, |
boolean | enable | ||
) |
Enable / disable auto commit mode.
The auto commit mode allows commit changes after every executed SQL order
con | - Connection handle |
enable | - Enable (TRUE) or disable (FALSE) |
Definition at line 897 of file connection.c.
OCI_EXPORT boolean OCI_API OCI_GetAutoCommit | ( | OCI_Connection * | con ) |
Get current auto commit mode status.
con | - Connection handle |
Definition at line 916 of file connection.c.
OCI_EXPORT OCI_Transaction* OCI_API OCI_TransactionCreate | ( | OCI_Connection * | con, |
unsigned int | timeout, | ||
unsigned int | mode, | ||
OCI_XID * | pxid | ||
) |
Create a new global transaction or a serializable/read-only local transaction.
con | - Connection handle |
timeout | - Time that a transaction stays inactive after being stopped |
mode | - Connection mode |
pxid | - pointer to a global transaction identifier structure |
Definition at line 46 of file transaction.c.
References OCI_TransactionFree().
OCI_EXPORT boolean OCI_API OCI_TransactionFree | ( | OCI_Transaction * | trans ) |
Free current transaction.
trans | - Connection handle |
Definition at line 155 of file transaction.c.
Referenced by OCI_DatabaseShutdown(), and OCI_TransactionCreate().
OCI_EXPORT boolean OCI_API OCI_TransactionStart | ( | OCI_Transaction * | trans ) |
Start global transaction.
trans | - Connection handle |
Definition at line 181 of file transaction.c.
OCI_EXPORT boolean OCI_API OCI_TransactionStop | ( | OCI_Transaction * | trans ) |
Stop current global transaction.
trans | - Connection handle |
Definition at line 207 of file transaction.c.
References OCI_Commit(), and OCI_Rollback().
Referenced by OCI_SetTransaction().
OCI_EXPORT boolean OCI_API OCI_TransactionResume | ( | OCI_Transaction * | trans ) |
Resume a stopped global transaction.
trans | - Global transaction handle |
Definition at line 244 of file transaction.c.
OCI_EXPORT boolean OCI_API OCI_TransactionPrepare | ( | OCI_Transaction * | trans ) |
Prepare a global transaction validation.
trans | - Global transaction handle |
Definition at line 270 of file transaction.c.
OCI_EXPORT boolean OCI_API OCI_TransactionForget | ( | OCI_Transaction * | trans ) |
Cancel the prepared global transaction validation.
trans | - Global transaction handle |
Definition at line 295 of file transaction.c.
OCI_EXPORT unsigned int OCI_API OCI_TransactionGetMode | ( | OCI_Transaction * | trans ) |
Return global transaction mode.
trans | - Global transaction handle |
Definition at line 320 of file transaction.c.
OCI_EXPORT unsigned int OCI_API OCI_TransactionGetTimeout | ( | OCI_Transaction * | trans ) |
Return global transaction Timeout.
trans | - Global transaction handle |
Definition at line 336 of file transaction.c.