Symisc Vedis

An Embeddable Datastore Engine

Vedis C/C++ API Reference - Command Execution.


int vedis_exec(vedis *pStore,const char *zCmd,int nLen);
int vedis_exec_fmt(vedis *pStore,const char *zFmt,...);

Execute one or more Vedis commands.


Use the following interface to execute the desired Vedis commands (See the following page for the list of built-in commands). After successful execution of the target command, the execution result (i.e. The return value) of the command can be extracted via vedis_exec_result().

Multiple commands can be executed in a single call via this interface by separating the target commands with a semi-colon ';' as follows:

vedis_exec(pStore,"SET key value; GET key",-1);

In which case, you should install a command output consumer callback to consume the return value of the multiple commands instead of calling vedis_exec_result() which return the value of the last executed command only. This operation can be done via vedis_config() with a configuration verb set to: VEDIS_CONFIG_OUTPUT_CONSUMER.

vedis_exec_fmt() is a work-alike of the "printf()" family of functions from the standard C library which is used to execute a small formatted string as follows:

vedis_exec_fmt(pStore,"SET %s %d","MyKey", 25 << 1);



Vedis datastore handle.


A null terminated string holding the commands to be executed.


zCmd length. If the nLen argument is less than zero, then zCmd is read up to the first zero terminator. If nLen is non-negative, then it is the maximum number of bytes read from zCmd

Return value

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

VEDIS_UNKNOWN Unknown command.

VEDIS_ABORT Executed command request an operation abort.

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.


Compile this C file for a smart introduction to these interfaces.

See also

vedis_exec_result, vedis_config.

Symisc Systems
Copyright © Symisc Systems