PackageDescription: BerkeleyDB

Berkeley DB

Last published: March 12, 2007 by 'michael'

Defines 54 Classes
Extends 55 Classes

This package implements a C Interface and Smalltalk classes for the BerkeleyDB library. This library is a single dll/so file that provides a Table-like database system with algorithms such as HASH, RECNO, QUEUE and BTREE. It is the core of what a database does and includes transactions, ACID, cursors, replication, XA transaction architecture and much much more.

To get started, download BerkeleyDB from and copy the libdb45.dll file in to your image directory. Then simply run something like this:

db := BerkeleyDB.Hash in: 'testing.db'.

@db will now act as a regular Smalltalk Dictionary. You can inspect it, use at:put:, at:, includesKey:, so on and so forth like a regular DB.

It also includes more advanced protocols for storing specific bit patterns, such as dwordsAt:, wordsAt:, at:putDwords:, at:putWords: and also streaming protocol such as at:putStream:.

When you read a value back from the database, you'll get a ValueByteArray (or similar class) that will act as a buffer in to the BerkeleyDB allowing random access in to 4gbs worth of data per key. See the other subclasses of BerkeleyDB.Database to see their particular properties. Also see Environments comment too.