The SME database interface controls access to the Postgress Database for IO and display of parameters and time series.  All data is stored in a set of tables in a DataBase.  The DataBase must be created by the postgress user using the createdb command.  A table is created when a new data file is imported.  

The SME command-line dBase interface gives the following functionality:

1) Listing DBase Contents:

a) General Contents:

  Execute: SME db -list

  Lists available databases.

  Execute: SME db dbaseName

  This command invokes psql on the specified database.  Within psql one can use  commands to list databases, tables in any database and execute SQL queries.
b) Table Contents:
  Execute: SME db dbaseName tableName dump series/hdep {sectorName}
  This command dumps a listing of the specified table in the specified dataBase.  The 5th arg specifies whether to dump series data or parameter data, and the last arg, if included, specifies that the named sector only should be dumped with it's data values.

2) Importing data to a table:

   Execute: SME db dbaseName tableName import series/hdep importFileName

   This command creates a new table and fills it with the data in importFileName.  The 5th arg specifies whether to import series data or parameter data.  Parameter data should be in FileMaker Pro export format ( contact voinov@cbl.cees.edu for details ).  If an old table named tableName exists in the dataBase then it is overwritten.   

3) Modifying Data in the DBase:

   Execute: SME db dbaseName tableName mod series/hdep sectorName parmName Habindex value {comment}

   This command changes that value associated with parameter parmName in sector sectorName with habitat index Habindex to value, and optionally sets the comment.

3) Inserting Data into the DBase:

   Execute: SME db dbaseName tableName ins series/hdep sectorName parmName Habindex value {comment}

   This command inserts a new data field into the table for parameter parmName in sector sectorName with habitat index Habindex etc.

4) Deleteing Data from the DBase:

   Execute: SME db dbaseName tableName del series/hdep sectorName parmName Habindex

   This command deletes field(s) from the table matching the specificed (sectorName parmName HabIndex).  Any or all of the wild card values ( sectorName="NULL", parmName="NULL" and HabIndex=0 ) may be used in the specification. 


