Symisc UnQLite

An Embeddable NoSQL Database Engine



UnQLite C/C++ API Reference - KV engine Config.

Syntax

int unqlite_kv_config(unqlite *pDb,int iOp,...);


Configure the underlying Key/Value (KV) storage engine.


Description


This routine is used to configure the underlying KV storage engine (i.e. Hash, B+Tree, R+Tree, Mem) with various configuration commands.


The second argument to unqlite_kv_config() is an integer configuration option that determines what property of the underlying KV engine is to be configured. Subsequent arguments vary depending on the configuration option in the second argument. Here is the list of allowed commands:


Commands
Expected Arguments
Description

UNQLITE_KV_CONFIG_HASH_FUNC
One Argument:

unsigend int (*xHash)(

const void  *pKey,

     unsigned int nLen

)

Specify a hash function to be used instead of the built-in hash function. This option accepts a single argument which is a pointer to the client hash function.

Note that the built-in hash function (DJB) is recommended for most purposes.

UNQLITE_KV_CONFIG_CMP_FUNC One Argument:

int (*xCmp)(

const void  *pUserKey,

const void  *pRecordKey,

     unsigned int nLen

)

Specify a comparison function to be used instead of the built-in comparison function. This option accepts a single argument which is a pointer to the client comparison function.

Note that the built-in comparison function (Tuned memcmp() implementation) is recommended for most purposes.


Parameters


pDb

A pointer to a unQLite Database Handle.

iOp

An integer configuration option that determines what property of the JX9 virtual machine is to be configured.


Return value


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


UNQLITE_UNKNOWN: Unknown configuration verb.


UNQLITE_NOTIMPLEMENTED: The underlying KV storage engine does not implement the xConfig() method.


See also


unqlite_kv_fetch, unqlite_kv_fetch_callback, unqlite_kv_append, unqlite_kv_store, unqlite_open, unqlite_close, unqlite_config.



Symisc Systems
Copyright © Symisc Systems