#
# $Id: EXAMPLES,v 1.3 2000/05/17 02:04:54 jonathan Exp $
#
# Jonathan B. Leffert <jonathan@leffert.net>
# 11 May 2000
#
# Simple example file, a brief tutorial on how to use the primitives.

First, you must create a database, for this example we'll use the database
name of "foo".

	gdbm-create -d foo

This creates a file in the current directory called "foo" or "foo.db"
depending on platform.

Now, we want to insert some values, say a username to gecos field mapping:

	gdbm-put -d foo jonathan "Jonathan B. Leffert"
	gdbm-put -d foo lwittgen "Ludwig Wittgenstein"
	gdbm-put -d foo rmhutchi "Robert Maynard Hutchins"
	gdbm-put -d foo root "Mr. Zero"

Now, we dump the contents of the database (n.b.: order may differ because
order is in no way guarenteed):

	gdbm-dump -d foo

		rmhutchi Robert Maynard Hutchins
		lwittgen Ludwig Wittgenstein
		root Mr. Zero
		jonathan Jonathan B. Leffert

But, suppose we want some wacko formatting:

	gdbm-dump -d foo -f "%s --> %s"

		rmhutchi --> Robert Maynard Hutchins
		lwittgen --> Ludwig Wittgenstein
		root --> Mr. Zero
		jonathan --> Jonathan B. Leffert

And if we just want one specific value back:

	gdbm-get -d foo root

		Mr. Zero

	gdbm-get -d foo -f "gecos: %s" root

		gecos: Mr. Zero

Of course, we can also give several keys to gdbm-get:

	gdbm-get -d foo -f "gecos: %s" root jonathan

		gecos: Mr. Zero
		gecos: Jonathan B. Leffert

Now, let's say the lwittgen key is no longer needed:

	gdbm-remove -d foo lwittgen

A gdbm-dump now looks like:

	gdbm-dump -d foo

		rmhutchi Robert Maynard Hutchins
		root Mr. Zero
		jonathan Jonathan B. Leffert

gdbm-revget behaves exactly the same as gdbm-get.

gdbm-clear has a syntax similar to gdbm-create.

gdbm-keys has a syntax similar to gdbm-dump and gdbm-get.

