Fire Foot API Reference Manual |
---|
FFTransaction — Class for handling transactions.
#include <ff-transaction.h> struct FFTransaction; struct FFTransactionClass; FFTransaction* ff_transaction_new (void); FFDatabase* ff_transaction_get_default_database (FFTransaction *self); void ff_transaction_set_default_database (FFTransaction *self, FFDatabase *db); const isc_tr_handle ff_transaction_get_handle (FFTransaction *self); gboolean ff_transaction_in_transaction (FFTransaction *self); gboolean ff_transaction_start (FFTransaction *self); gboolean ff_transaction_commit (FFTransaction *self); gboolean ff_transaction_rollback (FFTransaction *self);
Firebird is a transactional database, and because of that it uses a transaction for almost any operation. There are a few cases where transactions aren't needed, for example when you insert or delete a record from database using "DELETE FROM ..." or "INSERT INTO ...".
struct FFTransaction { gboolean def_action_rollback; /* Default: TRUE */ };
gboolean def_action_rollback | This is the default action for transaction close that is TRUE by default. |
struct FFTransactionClass { void (* on_start) (FFTransaction *self, gpointer data); void (* on_commit) (FFTransaction *self, gpointer data); void (* on_rollback) (FFTransaction *self, gpointer data); void (* on_close) (FFTransaction *self, gpointer data); void (* on_error) (FFTransaction *self, FFError *error, gpointer data); };
void (*on_start) (FFTransaction *self, gpointer data) | Triggers after the transaction is started. |
void (*on_commit) (FFTransaction *self, gpointer data) | Triggers after the transaction is commited. |
void (*on_rollback) (FFTransaction *self, gpointer data) | Triggers after transaction rollback. |
void (*on_close) (FFTransaction *self, gpointer data) | |
void (*on_error) (FFTransaction *self, FFError *error, gpointer data) | Triggers after an error is raised. |
FFTransaction* ff_transaction_new (void);
Constructor for FFTransaction class.
Returns : | A new FFTransaction object. |
FFDatabase* ff_transaction_get_default_database (FFTransaction *self);
Get self transaction default database.
self : | A FFTransaction. |
Returns : | Transaction's default FFDatabase object. |
void ff_transaction_set_default_database (FFTransaction *self, FFDatabase *db);
Set self transaction default database.
self : | A FFTransaction. |
db : | A FFDatabase. |
const isc_tr_handle ff_transaction_get_handle (FFTransaction *self);
Get transaction handle.
self : | A FFTransaction. |
Returns : | A transaction handle or NULL if transaction is not active. |
gboolean ff_transaction_in_transaction (FFTransaction *self);
See if transaction is in transaction.
self : | A FFTransaction. |
Returns : | TRUE if transaction is active, or FALSE otherwise. |
gboolean ff_transaction_start (FFTransaction *self);
Start transaction if is not olready opened.
self : | A FFTransaction. |
Returns : | TRUE if transaction was successfully opened, or FALSE otherwise. |
gboolean ff_transaction_commit (FFTransaction *self);
Commit current transaction.
self : | A FFTransaction. |
Returns : | TRUE if transaction was successfully commited, or FALSE otherwise. |
gboolean ff_transaction_rollback (FFTransaction *self);
Rollback current transaction.
self : | A FFTransaction. |
Returns : | TRUE if operation was successfully completed, or FALSE otherwise. |
<< FFDatabase | FFSql >> |