Symisc UnQLite

An Embeddable NoSQL Database Engine



UnQLite C/C++ API Reference - Transaction Manager.

Syntax

int unqlite_commit(unqlite *pDb);


Commit all changes to the database.


Description


Commit all changes to the database and release the exclusive lock. In other words, make sure that all changes reaches the disk surface.


Note: Normally, a call to this routine is not necessary since transactions are committed automatically by the engine when the database is closed via unqlite_close() unless the UNQLITE_CONFIG_DISABLE_AUTO_COMMIT option is set. In which case, you should manually call unqlite_commit(). Otherwise, the database is rolled back.


Tip: For maximum concurrency, it is recommended that you commit your transaction manually as soon as you have no more insertions. Also, for very large insertions (More than 20000), you should call unqlite_commit() periodically to free some memory (A new transaction is started automatically in the next insertion).


Parameters


pDb

A pointer to a unQLite Database Handle.


Return value


UNQLITE_OK is returned on success. Any other return value indicates failure such as:


UNQLITE_READ_ONLY: Read-only database.


UNQLITE_BUSY: Another thread or process have an exclusive lock on the database. In this case, the caller should wait until the lock holder relinquish it.


UNQLITE_IOERR: OS specific error. This error is considered harmful and you should perform an immediate rollback via unqlite_rollback().


UNQLITE_NOMEM: Out of memory (Unlikely scenario). This error is considered harmful and you should perform an immediate rollback via unqlite_rollback().


UNQLITE_ABORT: Another thread have released the database handle.


For a human-readable error message, you can extract the database error log via unqlite_config() with a configuration verb set to UNQLITE_CONFIG_ERR_LOG.


See also



unqlite_rollback, unqlite_begin, unqlite_open, unqlite_close, unqlite_config.



Symisc Systems
Copyright © Symisc Systems