Go to main content

dbhash_open

Open a database of type key/data.

DBHASH_OPEN

NAME

dbhash_open - Open a database of type key/data.

SYNOPSIS

dbhash_open (file:string, [,mode:integer,bnum:integer]);

DESCRIPTION

This function is used to open a key/data(nosql) database. The advantage of a key/data database over a relationnal database is the speed.

The disavantage is that a key/data does not support SQL.

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

    %define  GDBM_READER  0;        /* A reader. */
    %define  GDBM_WRITER  1;        /* A writer. */
    %define  GDBM_WRCREAT 2;        /* A writer.  Create the db if needed. */
    %define  GDBM_NEWDB   3;        /* A writer.  Always create a new db. */
    %define  GDBM_FAST    0x10; /* Write fast! => No fsyncs.  OBSOLETE. */
    %define  GDBM_SYNC    0x20; /* Sync operations to the disk. */
    %define  GDBM_NOLOCK  0x40; /* Don't do file locking operations. */
    %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_WRCREAT.
bnum
Block_size is the size of a single transfer from disk
to memory. This parameter is ignored unless the file is a new file.  The minimum size is 512.  If it is less than 512, dbm will use the stat block size  for
the file system.

RETURN

db
Pointer to the database. Used for all other call

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");

SEE ALSO

{{ include("includes/dbhash.sn") }}

AUTHOR

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

MODIFICATIONS

1.0 2015-02-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.