(sp_begin env)
sp_begin - start a multi-statement transaction
DESCRIPTION:
sp_begin(env): create a transaction
During transaction, all updates are not written to the database files until a sp_commit() is called. All updates that were made during transaction are available through sp_get() or by using cursor.
The sp_destroy() function is used to discard changes of a multi-statement transaction. All modifications that were made during the transaction are not written to the log file.
No nested transactions are supported.
For additional information take a look at Transactions and Deadlock sections.
RETURN VALUE:
On success, sp_begin() returns transaction object handle. On error, it returns NULL.
sp_begin - start a multi-statement transaction DESCRIPTION: sp_begin(env): create a transaction During transaction, all updates are not written to the database files until a sp_commit() is called. All updates that were made during transaction are available through sp_get() or by using cursor. The sp_destroy() function is used to discard changes of a multi-statement transaction. All modifications that were made during the transaction are not written to the log file. No nested transactions are supported. For additional information take a look at Transactions and Deadlock sections. RETURN VALUE: On success, sp_begin() returns transaction object handle. On error, it returns NULL.
(sp_commit tx)
sp_commit - commit a multi-statement transaction
DESCRIPTION:
sp_commit(transaction): commit a transaction
The sp_commit() function is used to apply changes of a multi-statement transaction. All modifications that were made during the transaction are written to the log file in a single batch.
If commit failed, transaction modifications are discarded.
For additional information take a look at Transactions and Deadlock sections.
RETURN VALUE:
On success, sp_commit() returns 0. On error, it returns -1. On rollback 1 is returned, 2 on lock.
sp_commit - commit a multi-statement transaction DESCRIPTION: sp_commit(transaction): commit a transaction The sp_commit() function is used to apply changes of a multi-statement transaction. All modifications that were made during the transaction are written to the log file in a single batch. If commit failed, transaction modifications are discarded. For additional information take a look at Transactions and Deadlock sections. RETURN VALUE: On success, sp_commit() returns 0. On error, it returns -1. On rollback 1 is returned, 2 on lock.
(sp_cursor env)
sp_cursor - common cursor operation
DESCRIPTION:
sp_cursor(env): create a cursor ready to be used with any database.
For additional information take a look at Cursor section.
RETURN VALUE:
On success, sp_cursor() returns cursor object handle. On error, it returns NULL.
sp_cursor - common cursor operation DESCRIPTION: sp_cursor(env): create a cursor ready to be used with any database. For additional information take a look at Cursor section. RETURN VALUE: On success, sp_cursor() returns cursor object handle. On error, it returns NULL.
(sp_delete db doc)
sp_delete - delete operation
DESCRIPTION:
sp_delete(database, document): do a single-statement transaction.
sp_delete(transaction, document): do a key deletion as a part of multi-statement transaction.
As a part of a transactional statement a key-value document must be prepared using sp_document() method. First argument of sp_document() method must be a database object.
Object must be prepared by setting key fields. Value is not used for delete operation. It is important that while setting key fields, only pointers are copied. Real data copies only during first operation.
For additional information take a look at sp_document(), sp_begin() and Transactions.
RETURN VALUE:
On success, sp_delete() returns 0. On error, it returns -1.
Database object commit: (1) rollback or (2) lock.
sp_delete - delete operation DESCRIPTION: sp_delete(database, document): do a single-statement transaction. sp_delete(transaction, document): do a key deletion as a part of multi-statement transaction. As a part of a transactional statement a key-value document must be prepared using sp_document() method. First argument of sp_document() method must be a database object. Object must be prepared by setting key fields. Value is not used for delete operation. It is important that while setting key fields, only pointers are copied. Real data copies only during first operation. For additional information take a look at sp_document(), sp_begin() and Transactions. RETURN VALUE: On success, sp_delete() returns 0. On error, it returns -1. Database object commit: (1) rollback or (2) lock.
(sp_destroy ref)
sp_destroy - free or destroy an object
DESCRIPTION:
The sp_destroy() function is used to free memory allocated by any Sophia object.
RETURN VALUE:
On success, sp_destroy() returns 0. On error, it returns -1.
sp_destroy - free or destroy an object DESCRIPTION: The sp_destroy() function is used to free memory allocated by any Sophia object. RETURN VALUE: On success, sp_destroy() returns 0. On error, it returns -1.
(sp_document db)
sp_document - create a document object
DESCRIPTION:
sp_document(database): create new document for a transaction on a selected database.
The sp_document() function returns an object which is intended to be used in by any CRUD operations. Document might contain a key-value pair with any additional metadata.
RETURN VALUE:
On success, sp_document() returns an object pointer. On error, it returns NULL.
sp_document - create a document object DESCRIPTION: sp_document(database): create new document for a transaction on a selected database. The sp_document() function returns an object which is intended to be used in by any CRUD operations. Document might contain a key-value pair with any additional metadata. RETURN VALUE: On success, sp_document() returns an object pointer. On error, it returns NULL.
(sp_env)
sp_env - create a new environment handle
DESCRIPTION:
The sp_env() function allocates new Sophia environment object.
The object is intended for usage by sp_open() and must be configured first. After using, an object should be freed by sp_destroy().
Please take a look at Configuration, and Database administration sections.
RETURN VALUE:
On success, sp_env() allocates new environment object pointer. On error, it returns NULL.
sp_env - create a new environment handle DESCRIPTION: The sp_env() function allocates new Sophia environment object. The object is intended for usage by sp_open() and must be configured first. After using, an object should be freed by sp_destroy(). Please take a look at Configuration, and Database administration sections. RETURN VALUE: On success, sp_env() allocates new environment object pointer. On error, it returns NULL.
(sp_get db doc)
sp_get - common get operation
DESCRIPTION
sp_get(database, document): do a single-statement transaction read.
sp_get(transaction, document): do a key search as a part of multi-statement transaction visibility.
sp_get() method returns a document that is semantically equal to sp_document(), but is read-only.
For additional information take a look at sp_begin() and Transactions.
RETURN VALUE:
On success, sp_get() returns a document handle. If an object is not found, returns NULL. On error, it returns NULL.
sp_get - common get operation DESCRIPTION sp_get(database, document): do a single-statement transaction read. sp_get(transaction, document): do a key search as a part of multi-statement transaction visibility. sp_get() method returns a document that is semantically equal to sp_document(), but is read-only. For additional information take a look at sp_begin() and Transactions. RETURN VALUE: On success, sp_get() returns a document handle. If an object is not found, returns NULL. On error, it returns NULL.
(sp_getbytes doc key)
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options
DESCRIPTION:
For additional information take a look at the Configuration section.
RETURN VALUE:
On success, sp_setstring() returns 0. On error, it returns -1.
On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL.
All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document.
On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1.
On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL.
The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options DESCRIPTION: For additional information take a look at the Configuration section. RETURN VALUE: On success, sp_setstring() returns 0. On error, it returns -1. On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL. All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document. On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1. On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL. The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
(sp_getint doc key)
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options
DESCRIPTION:
For additional information take a look at the Configuration section.
RETURN VALUE:
On success, sp_setstring() returns 0. On error, it returns -1.
On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL.
All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document.
On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1.
On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL.
The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options DESCRIPTION: For additional information take a look at the Configuration section. RETURN VALUE: On success, sp_setstring() returns 0. On error, it returns -1. On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL. All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document. On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1. On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL. The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
(sp_getobject env key)
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options
DESCRIPTION:
For additional information take a look at the Configuration section.
RETURN VALUE:
On success, sp_setstring() returns 0. On error, it returns -1.
On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL.
All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document.
On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1.
On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL.
The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options DESCRIPTION: For additional information take a look at the Configuration section. RETURN VALUE: On success, sp_setstring() returns 0. On error, it returns -1. On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL. All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document. On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1. On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL. The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
(sp_getstring doc key & {:keys [encoding] :or {encoding (default-encoding)}})
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options
DESCRIPTION:
For additional information take a look at the Configuration section.
RETURN VALUE:
On success, sp_setstring() returns 0. On error, it returns -1.
On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL.
All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document.
On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1.
On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL.
The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options DESCRIPTION: For additional information take a look at the Configuration section. RETURN VALUE: On success, sp_setstring() returns 0. On error, it returns -1. On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL. All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document. On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1. On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL. The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
(sp_open env)
sp_open - open or create
DESCRIPTION:
sp_open(env): create environment, open or create pre-defined databases.
sp_open(database): create or open database.
Please take a look at Configuration, and Database administration sections.
RETURN VALUE:
On success, sp_open() returns 0. On error, it returns -1.
sp_open - open or create DESCRIPTION: sp_open(env): create environment, open or create pre-defined databases. sp_open(database): create or open database. Please take a look at Configuration, and Database administration sections. RETURN VALUE: On success, sp_open() returns 0. On error, it returns -1.
(sp_set db doc)
sp_set - insert or replace operation
DESCRIPTION:
sp_set(database, document): do a single-statement transaction.
sp_set(transaction, document): do a key update as a part of multi-statement transaction.
As a part of a transactional statement a key-value document must be prepared using sp_document() method. First argument of sp_document() method must be a database object.
Object must be prepared by setting key and value fields, where value is optional. It is important that while setting key and value fields, only pointers are copied. Real data copies only during first operation.
For additional information take a look at sp_document(), sp_begin() and Transactions.
RETURN VALUE:
On success, sp_set() returns 0. On error, it returns -1.
Database object commit: (1) rollback or (2) lock.
sp_set - insert or replace operation DESCRIPTION: sp_set(database, document): do a single-statement transaction. sp_set(transaction, document): do a key update as a part of multi-statement transaction. As a part of a transactional statement a key-value document must be prepared using sp_document() method. First argument of sp_document() method must be a database object. Object must be prepared by setting key and value fields, where value is optional. It is important that while setting key and value fields, only pointers are copied. Real data copies only during first operation. For additional information take a look at sp_document(), sp_begin() and Transactions. RETURN VALUE: On success, sp_set() returns 0. On error, it returns -1. Database object commit: (1) rollback or (2) lock.
(sp_setbytes env key value)
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options
DESCRIPTION:
For additional information take a look at the Configuration section.
RETURN VALUE:
On success, sp_setstring() returns 0. On error, it returns -1.
On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL.
All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document.
On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1.
On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL.
The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options DESCRIPTION: For additional information take a look at the Configuration section. RETURN VALUE: On success, sp_setstring() returns 0. On error, it returns -1. On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL. All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document. On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1. On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL. The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
(sp_setint env key value)
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options
DESCRIPTION:
For additional information take a look at the Configuration section.
RETURN VALUE:
On success, sp_setstring() returns 0. On error, it returns -1.
On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL.
All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document.
On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1.
On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL.
The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options DESCRIPTION: For additional information take a look at the Configuration section. RETURN VALUE: On success, sp_setstring() returns 0. On error, it returns -1. On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL. All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document. On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1. On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL. The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
(sp_setstring env
key
value
&
{:keys [encoding] :or {encoding (default-encoding)}})
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options
DESCRIPTION:
For additional information take a look at the Configuration section.
RETURN VALUE:
On success, sp_setstring() returns 0. On error, it returns -1.
On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL.
All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document.
On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1.
On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL.
The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
sp_setstring, sp_getstring, sp_setint, sp_getint, sp_getobject - set or get configuration options DESCRIPTION: For additional information take a look at the Configuration section. RETURN VALUE: On success, sp_setstring() returns 0. On error, it returns -1. On success, sp_getstring() returns string pointer. On error or if the variable is not set, it returns NULL. All pointers returned by sp_getstring() must be freed using free(3) function. Exception is sp_document() object and configuration cursor document. On success, sp_setint() returns 0. On error, it returns -1. On success, sp_getint() returns a numeric value. On error, it returns -1. On success, sp_getobject() returns an object pointer. On error or if the variable is not set, it returns NULL. The database object returned by sp_getobject() increments its reference counter, sp_destroy() can be used to decrement it. This should be considered for online database close/drop cases.
(sp_upsert db doc)
sp_upsert - common get operation
DESCRIPTION:
sp_upsert(database, document): do a single-statement transaction.
sp_upsert(transaction, document): do a key update as a part of multi-statement transaction.
As a part of a transactional statement a key-value document must be prepared using sp_document() method. First argument of sp_document() method must be a database object.
Object must be prepared by setting key and value fields. It is important that while setting key and value fields, only pointers are copied. Real data copies only during first operation.
Value field should contain user-supplied data, which should be enough to implement custom update or insert logic.
To enable upsert command, a db.database_name.index.upsert and optionally db.database_name.index.upsert_arg must be set to callback function pointer.
For additional information take a look at sp_document(), sp_begin() and Transactions and Upsert sections.
RETURN VALUE:
On success, sp_set() returns 0. On error, it returns -1.
Database object commit: (1) rollback or (2) lock.
sp_upsert - common get operation DESCRIPTION: sp_upsert(database, document): do a single-statement transaction. sp_upsert(transaction, document): do a key update as a part of multi-statement transaction. As a part of a transactional statement a key-value document must be prepared using sp_document() method. First argument of sp_document() method must be a database object. Object must be prepared by setting key and value fields. It is important that while setting key and value fields, only pointers are copied. Real data copies only during first operation. Value field should contain user-supplied data, which should be enough to implement custom update or insert logic. To enable upsert command, a db.database_name.index.upsert and optionally db.database_name.index.upsert_arg must be set to callback function pointer. For additional information take a look at sp_document(), sp_begin() and Transactions and Upsert sections. RETURN VALUE: On success, sp_set() returns 0. On error, it returns -1. Database object commit: (1) rollback or (2) lock.
(with-ref v & body)
When v
is not nil
then body is executed and v
is destroyed (freed) after.
When `v` is not `nil` then body is executed and `v` is destroyed (freed) after.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close