Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/hst/observatory/crds/documents/comments_sql_gen.pdf
Дата изменения: Unknown
Дата индексирования: Sun Mar 2 08:20:06 2014
Кодировка:

Поисковые слова: южная атлантическая аномалия
comments sql gen
Rick Whitman November 27, 1996

Usage
The tool is invoked byentering comments sql gen on the command line followed by one argumentwhich is a le speci cation for the updated load le you want to process. For example:
comments_sql_gen a3d1145dy.lod

The input load le will generally have been created using the recreate load le command which recreates a load le based on the database contents for a particular reference le. The load le can then be edited to update the comments. No other keywords in the load le should be changed. Changing any of the mode keywords will invalidate the SQL that is produced bythis tool. There are also twoenvironmentvariables that must be de ned in order for the tool to perform some database actions using OpenSTDB. These environment variables are: CDBS SERVER - set to the database server name (in uppercase) CDBS DB - set to the CDBS database name (in lowercase) The output will be a single SQL le which, when executed will update appropriate database tables with the new comments contained in the load The le will be named comments delivery.sql where be the delivery number found in current version of the le-level relation in database. For example:
comments_delivery123.sql

the le. will the

The tool will also output a line indicating the input le currently being processed to stdout.
Processing a3d1145dy.lod ...

It will also write messages indicating errors, if they occur, to stdout. Upon detection of an error the task is terminated.


Algorithm/Module Description
The tool consists of a single le with several functions. It also calls functions from the loadutils library, the load le library and the OpenSTDB library. For each load le, the following steps occur: The load le is read into an internal structure using the read load le function from the load le library. This allows for the load le data to subsequently be referenced using the load le library functions. Next, SQL is generated to update the le-level and row-level relations in the database based on the le name and mode keywords in the load le. Note that for expanded load les, each of the le-level records associated with the reference le will be updated with the single comment in the load le header section. The row-level SQLisasfollows:
update where _row set comment = file_name = and mode_keyword1 = and mode_keyword2 = ... and mode_keywordN =

The le-level SQL is as follows:
update where _file set comment = file_name =

The < le name> is read from the header of the load le and the values are read from the rows of the detailed section of the load le. The lelevel commentand row level comments are read from the header and the detailed sections respectively The test script comments sql gen.sh is available to test the comments sql gen tool. The test script is invoked byentering its name. It is assumed that you are running the script from the cdbs/test/script directory and that yourdata isin the cdbs/test/data directory and that a cdbs/test/data/tmp directory exists. The script uses following les: 2

Testing


unex-hrs-init.lod - this le is an example of an initial unexpanded load le. unex-hrs-new.lod - this is the same load le as above but with the comments updated. ex-hrs-init.lod - this le is an example of an initial expanded load le. ex-hrs-new.lod - this is the same load le as above but with the comments updated. Note that these les are not intended to be accurate examples of CDBS load les but are only intended to demonstrate the various program paths. The following steps will take place during the test: cdbs sql gen will be run on unex-hrs-init.lod which will create the le cdbs delivery301.sql. The sql le will be executed to load the values into the database. The database will be queried to get the comments associated with the reference le loaded by unex-hrs-init.lod. The results of the query will be saved in unex-init.dat comments sql gen will be run on unex-hrs-new.lod which will create the le comments delivery301.sql. The sql le will be executed to load the values into the database. The database will be queried to get the comments associated with the reference le loaded by unex-hrs-new.lod. The results of the query will be saved in unex-new.dat cdbs sql gen will be run on ex-hrs-init.lod which will create the le cdbs delivery302.sql. The sql le will be executed to load the values into the database. The database will be queried to get the comments associated with the reference le loaded by ex-hrs-init.lod. The results of the query will be saved in unex-init.dat comments sql gen will be run on ex-hrs-new.lod which will create the le comments delivery302.sql. The sql le will be executed to load the values into the database. The database will be queried to get the comments associated with the reference le loaded by ex-hrs-new.lod. The results of the query will be saved in ex-new.dat unex-init.dat will be di erenced against unex-new.dat and ex-init.dat will be di erenced against ex-new.dat to show that the comments have been updated in the database 3