-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathREADME.txt
51 lines (33 loc) · 855 Bytes
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
A Berkeley DB style database implemented with a skip list instead of a b-tree. It's small, portable and supports ACID transactions (with true durability).
The license is Revised BSD.
Example:
#include "SkipDB.h"
int main(void)
{
Datum key;
Datum value;
int count;
// open
SkipDB *db = SkipDB_new();
SkipDB_setPath_(db, "test.skipdb");
SkipDB_open(db);
// write
SkipDB_beginTransaction(db);
key = Datum_FromCString_("testKey");
value = Datum_FromCString_("testValue");
SkipDB_at_put_(db, key, value);
SkipDB_commitTransaction(db);
// read
value = SkipDB_at_(db, key);
// count
count = SkipDB_count(db);
// remove
SkipDB_beginTransaction(db);
SkipDB_removeAt_(db, key);
SkipDB_commitTransaction(db);
// there's also a cursor API
// not shown in this example code
// close
SkipDB_close(db);
return 0;
}