NAME Table

This package is part of the DBMDatabase manpage.

Copyright &copy 1997 Curtis E. Dyreson. All rights reserved.


DESCRIPTION

This class represents a table in a DBMDatabase::Database. A table is a dbm file. Each entry in the table is a DBMDatabase::Tuple. The class has been configured to use either BSD, GDBM, or BigDB files. You must edit this package to configure it.


METHODS


new(string $tableName)

Create a table with the give name (opens a dbm file). Second line.


insertTuple(Tuple $tuple)

Insert a DBMDatabase::Tuple into the table. Will replace an existing tuple so be careful.


deleteTuple(Column $key)

Delete a tuple. The function returns true or false depending on whether or not the tuple found and deleted.


retrieveTuple(Column $key)

Retrieve a tuple with the given key from the table. This routine will retrieve a tuple from the table, or if the tuple is not found it will return 0. Use as follows.

   # we want to retrieve the tuple for the key "hi"
   $key = Id::fromString("hi");
   # try to retrieve it 
   $r = $table->retrieveTuple($key);    
   # let's test if we found it
   if ($r) { 
     # key was found in the table 
   else { 
     # key was not found
     }


IdIdImage()

Return a string of the key, value pairs (assumed to be Ids).


IdIdListImage()

Return a string of the key, value pairs (assumed to be Id Lists).


enumerate()

Return a reference to the dbm file.


enumerateKeys()

Return a list of the keys.


enumerateKeysAsInts()

Return a list of the key values, but as integer values rather than byte sequences.


KeysAsStringIds()

Return a string of the key values (assumed to be Ids).


save()

Close the DBM file


IdKeysImage()

Return a string of the key values (assumed to be Ids).