dbm/
misc/
old-docs/
Introduction
------------
	
	TeenyMUD 1.1 (and later revisions) are packaged with a
simple standalone database manager. This program is intended to allow
'bulk' database operations, such as deleting all the property owned by a
certain player, and so on. These operations cannot be efficiently carried out
in the MUD itself, as they require stepping through the entire database at
least once. Since the bulk of the database resides on disk, this is rather
slow.

Building the manager
--------------------

	Typing 'make teenydbm' in the mud directory should build the manager.

Using the manager
-----------------

	After building the manager, the command
'teenydbm <index file> <chunk file>' will bring the manager up, and give you a
'dbm>' prompt. The manager should only be applied to database files not
currently in use by a MUD -- the MUD will be merrily scribbling on its chunks
file. If the MUD is running, you should probably be doing this to a backup copy
of the database, in another directory.

At this prompt, you may enter a few commands:

select <expression> -- this selects a class of elements of the database for
	subsequent commands to operate on.

purge -- removes all the 'select'ed objects from the database, unlinks any
	exits with destinations at one of the removed objects, removes droptos
	to removed objects, and re-homes objects and players to zero, in the
	even that they are homed to any of the removed objects. When a room or
	player is purged, all the exits in the room/carried by the player are
	also purged, and the contents/inventory are all homed. Any objects
	remaining (i.e. objects homed to the room, generally) are also
	destroyed.

summarize -- prints a summary of all the selected objects. Useful for counting
	wizards and so forth.

chown <object number> -- chowns all the selected objects to the specified
	object (usually a player). This is designed mostly for coping
	with a toad's possessions.

quit -- gets you out, and writes the modified datbase back. Note that, as with
	a MUD, shutting the manager down ungracefully will result in a
	corrupted database. This is not surprising, since the manager uses the
	same database library.

Selecting Objects
-----------------

	The <expression> referred to in the 'select' command is a Boolean
expression involving the usual Boolean operators (&, | and ! -- just like locks
in the MUD) and various atomic statements. Each atomic statement is either true
or false of every object in the database. An object is deemed 'select'ed if the
Boolean expression evaluates to true. The atomic statements are as follows:

name=<word with no spaces>   -- this is true if the specified string
	OR                      is a substring of the name of the object
name="<string>"


owner=#<number>  -- true if object number <number> owns the object

flag=<one of W, S, D, L> -- true if the object's flags include WIZARD, STICKY,
                            DARK, or LINK_OK, respectively.

type=<one of R, P, T, E> -- true if the object is of type ROOM, PLAYER,
                            THING, or EXIT, respectively.

#<number> -- true only of object number <number>

The following two are enabled only if the db manager is compiled with
TIMESTAMPS defined in includes/teeny.h. Note that the database such a manager
is applied to MUST have been built with a TeenyMUD also compiled with
TIMESTAMPS defined (also in includes/teeny.h).

unused > <number> <one of d,h,m> -- true of objects unused for more than
                            <number> days, hours, or minutes, respectively.
unused < <number> <one of d,h,m> -- true of objects unused for less than
                            <number> days, hours, or minutes, respectively.

Examples
--------

dbm>select #12679

	will select object number #12679

dbm>select owner=#89731

	will select all objects owned by #89731

dbm>select (flag=W & unused>100d) | (type = T & flag=D)

	will select all those objects which are wizards, unused for more than
100 days, or are DARK things.

dbm>select (owner=#12790 & unused <12m & flag=L) | (type=P)

	will select all those things owned by #12790 which *have* been used in
the last 12 minutes, and which are LINK_OK, as well as all those objects of
type PLAYER.