APBCDB 0.2

A constant key-value database library

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!
send us
an update
LICENSE TYPE:
MIT/X Consortium License 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Asher
HOMEPAGE:
www.wildsparx.com
CATEGORY:
ROOT \ Database \ Database APIs
Apbcdb is a library for C programmers and it cannot be used directly by users.

Performance

Benchmarked as follows:

 * 1.8 GHz machine; 1GB RAM
 * Lookup keys were randomly distributed.
 * 50% of lookup keys were present in the database.

How to use APBCDB

General


 * Include apbcdb.h
 * All functions return a result code.
 o Always check it.
 o If it's nonzero, it's one of the errors listed in the header file.
 o Don't proceed past an error result.
 * Add the apbcdb directory to your project and link with:
 o apbcdb_writer.o
 o apbcdb_reader.o
 o apbindex/apbindex.o

Creating a DB

apbcdb_writer w;
int rc;

rc = apbcdb_begin_write(&w, "phonebook.dat");

rc = apbcdb_add_entry(&w, strlen("Bob Smith"), "Bob Smith",
 strlen("408.921.9191"), "408.921.9191");

rc = apbcdb_add_entry(&w, strlen("Jen Rapp"), "Jen Rapp",
 strlen("714.334.5543"), "714.334.5543");

rc = apbcdb_end_write(&w);
/* this creates phonebook.dat.idx; both files must be present to read */


Reading a DB

apbcdb_reader r;
int rc;
char val[0x400];
uint vallen;

rc = apbcdb_ropen(&r, "phonebook.dat");
vallen = sizeof(val);
rc = apbcdb_get(&r, "Bob Smith", strlen("Bob Smith"), val, &vallen);
/* now val contains Bob's phone number, and vallen contains the
 * phone number's length */
rc = apbcdb_rclose(&r);

Last updated on December 8th, 2008

feature list

#constant key-value #database API #C library #constant #key-value #database #library

Add your review!

SUBMIT