| ActiveTcl User Guide |

# xotcl/library/store/Storage.xotcl

## Package/File Information

No package provided/required
Defined Objects/Classes:

- Storage: close, exists, firstkey, names, nextkey, open, set, someNewChildStore, unset.

Filename: xotcl/library/store/Storage.xotcl

Description: | Simple generic storage interface for hashtable-like (persistent) storages. There are several different existing stores, including a memory storage, a GDBM storage, a SDBM storage, and a TextFile storage.
Date: | $Date: 2005/09/09 21:09:01 $

## Class: Storage

Class: Class
Procs/Instprocs: close, exists, firstkey, names, nextkey, open, set, someNewChildStore, unset.

Description: | Abstract storage interface class (superclass of all storages).

### Instprocs

- open filename

  Arguments: | filename: database filename (or filename base, if more than one file has to be created)
  Description: | Each storage object represents exactly one database table. The db has to be opened, before it can it used. If it is not opened all other methods return errors.
  Return: | empty string

- close

  Description: | Close associated database.
  Return: | empty string

- exists key

  Arguments: | key: Key to be searched for.
  Description: | Search for a key whether it exists or not.
  Return: | 1, if key exists in the database, otherwise 0

- set key ?value?

  Arguments: | key: Key to be set.
  | ?value?: Optional value that might be set
  Description: | Set or query a database key in the same way as Tcl's set functions.
  Return: | Key value.

- unset key

  Arguments: | key: Key to be unset.
  Description: | Unset a database key in the same way as Tcl's unset functions.
  Return: | empty string

- names

  Description: | Return a list of keys in the database (functions in the same way as Tcl's array names)
  Return: | List of keys in the db.

- firstkey

  Description: | Start a traversal of the database, starting with any key.
  Return: | Name of first key.

- nextkey

  Description: | Proceed with the db traversal. Requires a firstkey before first usage, otherwise it returns an error.
  Return: | Name of next key, if one exists. Otherwise an empty string is returned.

### Procs

- someNewChildStore

  Description: | Create a childStore according to a preference list depending on which storages are available. Currently the preference list has the following order: Gdbm, Sdbm and TextFile.
  Return: | name of the created storage object.

Back to index page.