Next: , Previous: , Up: Top   [Index]


5 Database Functions

database

database database(void);

is a new database

db_cache

void db_cache(database db, integer size);

set the maximum cache size db database to size * 65536 bytes. The limit applies only to unmodified blocks (b-tree nodes and large keys and data pages).

db_close

void db_close(database db);

closes the db database. All the associated tables are closed.

db_fashion

void db_fashion(database db, integer s);

adds s to the db database flags set.

See Database Open Definitions.

db_flush

void db_flush(database db);

writes changes to the disk store.

db_messages

void db_messages(database db, text path);

sets the path to the nonblonde message log. No messages are written for a void path (the default value). The function only has effect if called before ‘db_open’*.

db_open, db_open2

database db_open(database db, text path);
database db_open2(database db, text path, integer cache);

are db, open db for the database store indicated by path. If the disk store does not exist, it is created.

cache indicates the desired maximal size of the cached b-tree node data in 64 kilobytes increments. The actual cached size will exceed the indicated amount when in memory changes reserve a larger combined b-tree node data size. The limit does not apply to the total reserved memory, including allocation padding, supporting data structures, etc.

Having a data store opened multiple times simultaneously will likely have the result of irreparably corrupting it.

db_refine

void db_refine(database db, integer s);

removes s from the db database flags set.

See Database Open Definitions.

db_remap

void db_remap(database db);

compacts the page map of the db database.

db_remove

void db_remove(text path);

removes the database at path.

db_restore

integer db_restore(database db, integer store);

is the combined size of high file offset blocks in the data store of the db database the function moves to lower file offsets. It will not exceed store if more than one block was moved, and it is expressed in 64 kilobytes units, same as store.

db_sync

void db_sync(database db);

asks the operating system to flush its cache of the database files on disk (calls fdatasync(2) on the opened database files).

db_table

table db_table(database db, text name);

is a new table object, opened for the db table indicated by the 8 characters long name (same as ‘table’().‘keep’(db, name)).

db_tables

list db_tables(database db);

is the list of the db table names.


Next: , Previous: , Up: Top   [Index]