function

dbhash_put . dbhash . sncode

VERSIONlatest Insert a value in the database.

DBHASH_PUT(1e)

NAME

dbhash_put - Insert a value in the database.

SYNOPSIS

dbhash_put (db:pointer, key:string, value:string [,mode:integer]);

DESCRIPTION

This function is used to put a key/data(nosql) in the database.

The following definitions could be used for key/data operation:

Mode can be:

    %define  GDBM_INSERT  0;        /* Never replace old data with new. */
    %define  GDBM_REPLACE 1;        /* Always replace old data with new. */

PARAMETERS

mode
Specify mode. Default is GDBM_REPLACE.

RETURN

If a reader calls dbhash_put the return value will be  -1.  If called with GDBM_INSERT and key is in the database, the return value will be 1.   Otherwise,
the return value is 0.

MODULES

To use this module, you must specify the following in /usr/local/website/site.conf:

Module hash {
    Library : "/usr/local/lib/libsndbhash.so"
    Init : "sndbhash_init"
}

EXAMPLES

hash = dbhash_open("/hash/test.db");

ret = dbhash_put(db:hash,key:"cookie",value:"aurhfqiuwrhf");

 

AUTHOR

Written by Pierre Laplante, <laplante@sednove.com>