Database -- the class of all database files

Description

A database file is just like a hash table, except both the keys and values have to be strings. In this example we create a database file, store a few entries, remove an entry with remove, close the file, and then remove the file.
 i1 : filename = temporaryFileName () | ".dbm" o1 = /tmp/M2-248011-0/0.dbm i2 : x = openDatabaseOut filename o2 = /tmp/M2-248011-0/0.dbm o2 : Database i3 : x#"first" = "hi there" o3 = hi there i4 : x#"first" o4 = hi there i5 : x#"second" = "ho there" o5 = ho there i6 : scanKeys(x,print) second first i7 : remove(x,"second") i8 : scanKeys(x,print) first i9 : close x o9 = 0 i10 : removeFile filename

Functions and methods returning a database :

• "openDatabase(String)" -- see openDatabase -- open a database file
• "openDatabaseOut(String)" -- see openDatabaseOut -- open a database file for writing

Methods that use a database :

• "Database #? String" -- see #? -- check existence of value in a list, hash table, database, or string
• "Database # String" -- see BasicList # ZZ -- get value from list, hash table, database, or string
• "isOpen(Database)" -- see isOpen -- whether a file or database is open
• "keys(Database)" -- see keys -- keys used in a hash table, dictionary, or database
• "Manipulator Database" -- see Manipulator -- the class of all file manipulators
• "scanKeys(Database,Function)" -- see scanKeys -- apply a function to each key in a hash table or database

For the programmer

The object Database is a type, with ancestor class Thing.