X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fdb.h;h=41b81aa1308fb2a533d809fb80e7c2441e0dd68d;hb=88714d18176f047eb4d298bb3f22520217671513;hp=78fc804a4b113db55e71d293d1e837ac0f158624;hpb=a9397765ec1fc7102c080ed072173ce0ee156050;p=libucw.git diff --git a/lib/db.h b/lib/db.h index 78fc804a..41b81aa1 100644 --- a/lib/db.h +++ b/lib/db.h @@ -1,11 +1,14 @@ /* - * Sherlock Library -- Fast Database Management Routines + * UCW Library -- Fast Database Management Routines * - * (c) 1999 Martin Mares + * (c) 1999--2001 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. */ -#ifndef _SHERLOCK_DB_H -#define _SHERLOCK_DB_H +#ifndef _UCW_DB_H +#define _UCW_DB_H struct sdbm; @@ -18,11 +21,6 @@ struct sdbm_options { /* Set to 0 for default */ int val_size; /* Value size, -1=variable */ }; -struct sdbm_buf { - uns size; - byte data[0]; -}; - struct sdbm *sdbm_open(struct sdbm_options *); void sdbm_close(struct sdbm *); int sdbm_store(struct sdbm *, byte *key, uns keylen, byte *val, uns vallen); @@ -32,6 +30,7 @@ int sdbm_fetch(struct sdbm *, byte *key, uns keylen, byte *val, uns *vallen); / void sdbm_rewind(struct sdbm *); int sdbm_get_next(struct sdbm *, byte *key, uns *keylen, byte *val, uns *vallen); /* val can be NULL */ void sdbm_sync(struct sdbm *); +u32 sdbm_hash(byte *key, uns keylen); #define SDBM_CREAT 1 /* Create the database if it doesn't exist */ #define SDBM_WRITE 2 /* Open the database in read/write mode */ @@ -46,5 +45,6 @@ void sdbm_sync(struct sdbm *); #define SDBM_ERROR_BAD_VAL_SIZE -2 /* Fixed value size doesn't match */ #define SDBM_ERROR_TOO_LARGE -3 /* Key/value doesn't fit in buffer supplied */ #define SDBM_ERROR_READ_ONLY -4 /* Database has been opened read only */ +#define SDBM_ERROR_GIANT -5 /* Key/value too large to fit in a page */ #endif