APBCDB 0.2

A constant key-value database library
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);

Main features:

  • Fast lookups.
  • Multiple readers can share the db efficiently.
  • UTF-8 safe and binary-safe. Merely stores byte sequences.
  • C API for DB creation.
  • Clear, maintainable code.
  • Permissive license.

last updated on:
December 8th, 2008, 3:54 GMT
price:
FREE!
homepage:
www.wildsparx.com
license type:
MIT/X Consortium License 
developed by:
Asher
category:
ROOT \ Database \ Database APIs
APBCDB
Download Button

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Rate it!

Add your review!

SUBMIT