Procedure Information for wsDatabase.tcl:

  1. readDbFldDesc
  2. buildDb
  3. readMdb
  4. dumpDesc
  5. readDb
  6. configureDb
  7. writeDb
  8. processRecord
  9. processConst
  10. readTxt
  11. getField
  12. nameDbNS
  13. openDb
  14. serializeDb
  15. setDbVal
  16. getDbVal
  17. existDbVal
  18. dumpDbVal
  19. dumpDbState
  20. setTag
  21. getTag
  22. existTag
  23. dumpTag
  24. splitKey
  25. joinKey


    Procedure: readDbFldDesc

    Extract a database field descriptor line from a database file.


    Procedure Data

    • Name: readDbFldDesc
    • Parent Namespace: webSubmit::database
    • Arglist: dbFile keyword
    • Return: Status


    Argument definitions:

    • dbFile : Path to the database file.
    • keyword : The keyword used to pick the descriptor line out database file dbFile


    Procedure: buildDb

    Procedure to build a generic database. Can handle a build from a metadatabase (*.mdb), a regular database (*.db), or a serialized database (*.tcl).


    Procedure Data

    • Name: buildDb
    • Parent Namespace: webSubmit::database
    • Arglist: pathName {NS ""}
    • Return: Status


    Argument definitions:

    • pathName : Path to the database file.
    • NS (Optional): Namespace name for database (Default = "")


    Procedure: readMdb

    Procedure to read a generic metadatabase file containing metadatabase and main codatabase record attributes lines, comments, and a set of record bundles for the main and auxiliary codatabases. The main codatabase namespace must have already been opened with openDb or with some equivalent ad hoc procedure. The pathname rootname of the file (all but the extension) must be already defined in the dbFile file variable of the namespace. An extension of .mdb will be assumed. The auxiliary codatabases will be opened. The


    Procedure Data

    • Name: readMdb
    • Parent Namespace: webSubmit::database
    • Arglist: mainDbNS
    • Return: Status


    Argument definitions:

    • mainDbNS : The name of the namespace associated with the main codatabase.


    Procedure: dumpDesc

    Print current state of DESC array.


    Procedure Data

    • Name: dumpDesc
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS keywordList ptrDESC
    • Return: None.


    Argument definitions:

    • dbNS : Name of the database namespace.
    • keywordList : List of descriptor keywords
    • ptrDESC : Pointer to the metadatabase descriptor array.


    Procedure: readDb

    Read a simple general database file containing a record attributes line, comments, and a set of records. The material read is inserted in a database namespace. The namespace must already have been opened with openDb or by some equivalent ad hoc procedure. The pathname rootname of the file (all but extension) must be already defined in the dbFile variable of the namespace. An extension of .db will be assumed. 1) Create a mapping from the concatenated key fields of a record to the concatenated attribute fields. 2) Augment the mapping to produce mappings from the concatenated keys comma the attribute field name to the attribute field value for each attribute in each record. - If there is a key field named auto, it is not specified in the record, but an automatically generated index number (0, 1, 2, ...) should be supplied for it. - If there is non-key field called auto, it, too, is not specified in the record, but an automatically generated index number (0, 1, 2, ...) should be supplied for it. - If there is a field named tag, it contains a unique identifier that serves as a name for that record. Define that tag with setTag.


    Procedure Data

    • Name: readDb
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS
    • Return: Status (Error = 1)


    Argument definitions:

    • dbNS : Name of the namespace in which the database will be stored. The file to be read should have been stored in $dbNS::dbfile by openDb (or an ad hoc opening process).


    Procedure: configureDb

    Given the attribute line for a database, initialize the open database namespace.


    Procedure Data

    • Name: configureDb
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS dbFieldList
    • Return: Key.


    Argument definitions:

    • dbNS : Name of the namespace containing the database.
    • dbFieldList : List of fields in the database (with key and auto annotations).


    Procedure: writeDb

    Process a database namespace $dbNS to produce a database *.db file.


    Procedure Data

    • Name: writeDb
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS {pathName ""}
    • Return: Status.


    Argument definitions:

    • dbNS : Name of the database namespace.
    • pathName (Optional): Path to database file (Default = "")


    Procedure: processRecord

    Process database record input format to produce entries in DB.


    Procedure Data

    • Name: processRecord
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS record storageMode index


    Argument definitions:

    • dbNS : Name of the database namespace.
    • record : String representing a colon-delimited database input record.
    • storageMode : Either scalar or list. Scalar means set the element of the database to the value; list means append the value to what is there.
    • index : Number of record (0, 1, ...).


    Procedure: processConst

    Process metadatabase corecord of type const to produce a const entry in main codatabase.


    Procedure Data

    • Name: processConst
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS constRecord storageMode
    • Return: Constant name


    Argument definitions:

    • dbNS : Name of the main codatabase namespace.
    • constRecord : String representing a colon-delimited database const line.
    • storageMode : Either scalar or list. Scalar means set the element of the database to the value; list means append the value to what is there.


    Procedure: readTxt

    Text read procedure: Reads text regions from a file. Each region is delimited by a key value that corresponds to a key from another database


    Procedure Data

    • Name: readTxt
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS
    • Return: Status (Error = 1)


    Argument definitions:

    • dbNS : Namespace for text data


    Procedure: getField

    Procedure to extract fields from list with separators Leading and trailing white space is stripped from each element


    Procedure Data

    • Name: getField
    • Parent Namespace: webSubmit::database
    • Arglist: entry ifs
    • Return: List corresponding to input string


    Argument definitions:

    • entry : String to extract
    • ifs : Internal Field Separator for entry


    Procedure: nameDbNS

    Derive the namespace of a database from the pathname by computing the tail of the root of the pathname.


    Procedure Data

    • Name: nameDbNS
    • Parent Namespace: webSubmit::database
    • Arglist: dbPathName
    • Return: Status


    Argument definitions:

    • dbPathName : Pathname to the database file.


    Procedure: openDb

    Instantiate a database namespace.


    Procedure Data

    • Name: openDb
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS {dbFile ""} {reqAttrList {}}
    • Return: Status


    Argument definitions:

    • dbNS : Name of the namespace to contain the database
    • dbFile (Optional): Name of the file defining the database (Default = "")
    • reqAttrList (Optional): List of required non-ley attributes (fields) (Default = {})


    Procedure: serializeDb

    Serialize a database namespace.


    Procedure Data

    • Name: serializeDb
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS {pathName ""}
    • Return: None


    Argument definitions:

    • dbNS : Name of the namespace to contain the database
    • pathName (Optional): Path to serialized file (Default = "")


    Procedure: setDbVal

    Given a database namespace, a key, and a field, set the value of that field.


    Procedure Data

    • Name: setDbVal
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS value key {fieldName ""}
    • Return: Error status (0 = no error)


    Argument definitions:

    • dbNS : Name of the namespace containing the database.
    • value : Value of entry in database
    • key : Key of the record of interest.
    • fieldName (Optional): Name of the field of interest. (Default = "")


    Procedure: getDbVal

    Given a database namespace, a key, and a field, return the value of that field.


    Procedure Data

    • Name: getDbVal
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS key {fieldName ""}
    • Return: Value of field


    Argument definitions:

    • dbNS : Name of the namespace containing the database.
    • key : Key of the record of interest.
    • fieldName (Optional): Name of the field of interest. (Default = "")


    Procedure: existDbVal

    Given a database namespace, a key, and a field, determine if the field exists.


    Procedure Data

    • Name: existDbVal
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS key {fieldName ""}
    • Return: True (1) or false (0).


    Argument definitions:

    • dbNS : Name of the namespace containing the database.
    • key : Key of the record of interest.
    • fieldName (Optional): Name of the field of interest. (Default = "")


    Procedure: dumpDbVal

    Print current state of DB array.


    Procedure Data

    • Name: dumpDbVal
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS
    • Return: None.


    Argument definitions:

    • dbNS : Name of the database namespace.


    Procedure: dumpDbState

    Print current state of database.


    Procedure Data

    • Name: dumpDbState
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS
    • Return: None.


    Argument definitions:

    • dbNS : Name of the database namespace.


    Procedure: setTag

    Given a database namespace, a tag, and a key, map that tag to that key. A tag is a predefined name equivalent to some key, usually a key that depends on autoindexing for its value.


    Procedure Data

    • Name: setTag
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS key tag
    • Return: Error status (0 = no error)


    Argument definitions:

    • dbNS : Name of the namespace containing the database.
    • key : Key.
    • tag : Tag.


    Procedure: getTag

    Given a database namespace and a tag, return the key referenced by that tag. A tag is a predefined name equivalent to some key, usually a key that depends on autoindexing for its value. Create an array TAG2KEY that maps tag values to keys, i.e., [getDbVal $dbNS TAG2KEY($tag) $attrName] is the value of the field $attrName of the record named $tag.


    Procedure Data

    • Name: getTag
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS tag
    • Return: Key.


    Argument definitions:

    • dbNS : Name of the namespace containing the database.
    • tag : Tag name.


    Procedure: existTag

    Given a database namespace and a tag name, determine if the tag is defined for the database. A tag is a predefined name equivalent to some key, usually a key that depends on autoindexing for its value.


    Procedure Data

    • Name: existTag
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS tag
    • Return: True (1) or false (0).


    Argument definitions:

    • dbNS : Name of the namespace containing the database.
    • tag : Tag name.


    Procedure: dumpTag

    Print current state of TAG2KEY array.


    Procedure Data

    • Name: dumpTag
    • Parent Namespace: webSubmit::database
    • Arglist: dbNS
    • Return: None.


    Argument definitions:

    • dbNS : Name of the database namespace.


    Procedure: splitKey

    Convert $key to list of key attribute values.


    Procedure Data

    • Name: splitKey
    • Parent Namespace: webSubmit::database
    • Arglist: key
    • Return: The list of key attribute values.


    Argument definitions:

    • key : The key.


    Procedure: joinKey

    Make a key from a list of key attributes.


    Procedure Data

    • Name: joinKey
    • Parent Namespace: webSubmit::database
    • Arglist: keyList
    • Return: The concatenated key.


    Argument definitions:

    • keyList : A list of key attribute values to be made into a key.