Symisc Vedis

An Embeddable Datastore Engine



Vedis C/C++ API Reference - Datastore Handle.

Syntax

int vedis_open(vedis **ppStore,const char *zStorage);


Obtaining a new Vedis datastore handle.


Description


This routine allocate and initialize a new datastore object handle whose name is given by the zStorage argument. A datastore connection is usually returned in *ppStore but, if the engine is unable to allocate memory to hold the vedis object, a NULL will be written into *ppStore instead of a pointer to the vedis object. This routine is often the first API call that an application makes and is a prerequisite in order to play with the library.


If zStorage is ":mem:" or NULL, then a private, in-memory datastore is created for the connection. The in-memory datastore will vanish when the database connection is closed. Future versions of Vedis might make use of additional special filenames that begin with the ":" character. It is recommended that when a database filename actually does begin with a ":" character you should prefix the filename with a pathname such as "./" to avoid ambiguity.

Note: Transactions are not supported for in-memory databases.


Note: This routine does not open the target database file. It merely initialize and prepare the datastore object handle for later usage.


Parameters


ppStore

OUT: A fresh datastore connection is written into this pointer.

  zStorage

Relative or full path to the target database file. If zStorage is ":mem:" or NULL then a private, in-memory datastore is created for the connection.


Return value


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


VEDIS_MEM Out of memory (Unlikely scenario).


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


See also


vedis_close, vedis_config.



Symisc Systems
Copyright © Symisc Systems