upscaledb  2.2.1
Macros | Typedefs | Functions
upscaledb Txn Functions

Macros

#define UPS_TXN_READ_ONLY   1
 
#define UPS_TXN_TEMPORARY   2
 

Typedefs

typedef struct ups_txn_t ups_txn_t
 

Functions

UPS_EXPORT ups_status_t ups_txn_begin (ups_txn_t **txn, ups_env_t *env, const char *name, void *reserved, uint32_t flags)
 
UPS_EXPORT const char * ups_txn_get_name (ups_txn_t *txn)
 
UPS_EXPORT ups_status_t ups_txn_commit (ups_txn_t *txn, uint32_t flags)
 
UPS_EXPORT ups_status_t ups_txn_abort (ups_txn_t *txn, uint32_t flags)
 

Detailed Description

Macro Definition Documentation

#define UPS_TXN_READ_ONLY   1

Flag for ups_txn_begin

Definition at line 1202 of file upscaledb.h.

#define UPS_TXN_TEMPORARY   2

Definition at line 1205 of file upscaledb.h.

Typedef Documentation

typedef struct ups_txn_t ups_txn_t

Definition at line 1167 of file upscaledb.h.

Function Documentation

UPS_EXPORT ups_status_t ups_txn_abort ( ups_txn_t txn,
uint32_t  flags 
)

Aborts a Txn

This function aborts (= cancels) the sequence of Database operations.

Note that the function will fail with UPS_CURSOR_STILL_OPEN if a Cursor was attached to this Txn (with ups_cursor_create or ups_cursor_clone), and the Cursor was not closed.

Parameters
txnPointer to a Txn structure
flagsOptional flags for aborting the Txn, combined with bitwise OR. Unused, set to 0.
Returns
UPS_SUCCESS upon success
UPS_IO_ERROR if writing to the Database file or logfile failed
UPS_CURSOR_STILL_OPEN if there are Cursors attached to this Txn

Referenced by upscaledb::txn::abort().

UPS_EXPORT ups_status_t ups_txn_begin ( ups_txn_t **  txn,
ups_env_t env,
const char *  name,
void *  reserved,
uint32_t  flags 
)

Begins a new Txn

A Txn is an atomic sequence of Database operations. With ups_txn_begin such a new sequence is started. To write all operations of this sequence to the Database use ups_txn_commit. To abort and cancel this sequence use ups_txn_abort.

In order to use Transactions, the Environment has to be created or opened with the flag UPS_ENABLE_TRANSACTIONS.

You can create as many Transactions as you want (older versions of upscaledb did not allow to create more than one Txn in parallel).

Parameters
txnPointer to a pointer of a Txn structure
envA valid Environment handle
nameAn optional Txn name
reservedA reserved pointer; always set to NULL
flagsOptional flags for beginning the Txn, combined with bitwise OR. Possible flags are:
Returns
UPS_SUCCESS upon success
UPS_OUT_OF_MEMORY if memory allocation failed

Referenced by upscaledb::env::begin().

UPS_EXPORT ups_status_t ups_txn_commit ( ups_txn_t txn,
uint32_t  flags 
)

Commits a Txn

This function applies the sequence of Database operations.

Note that the function will fail with UPS_CURSOR_STILL_OPEN if a Cursor was attached to this Txn (with ups_cursor_create or ups_cursor_clone), and the Cursor was not closed.

Parameters
txnPointer to a Txn structure
flagsOptional flags for committing the Txn, combined with bitwise OR. Unused, set to 0.
Returns
UPS_SUCCESS upon success
UPS_IO_ERROR if writing to the file failed
UPS_CURSOR_STILL_OPEN if there are Cursors attached to this Txn

Referenced by upscaledb::txn::commit().

UPS_EXPORT const char* ups_txn_get_name ( ups_txn_t txn)

Retrieves the Txn name

Returns
NULL if the name was not assigned or if txn is invalid

Referenced by upscaledb::txn::get_name().