Headers for LASCO IDL Library: DATABASE

This page was created by IDL lasco_mk_html_help.pro on Wed Aug 17 12:21:33 2005.


List of Routines


Routine Descriptions

DB_INSERT

[List of Routines] (See ./db_insert.pro)

 NAME:				db_insert
 PURPOSE:			writes SQL statements to insert a record 
                               into a dbms table
 CATEGORY:			DBMS
 CALLING SEQUENCE:		db_insert,a
 INPUTS:			a = a dbms table structure where the first
                                   element of the structure is the data base 
				    name, the second element is the table name
                                   and other structure elements are the 
                                   column names of the table.
       
 OPTIONAL INPUT PARAMETERS:	None
 KEYWORD PARAMETERS:		None
 OUTPUTS:			None
 OPTIONAL OUTPUT PARAMETERS:   None
 COMMON BLOCKS:		dbms,ludb
				ludb = unit number of the file to write to
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:		RAHoward NRL 10/27/95
      V2   RAH   02/05/96   Corrected handling of first/last elements of array
      V3   RAH   02/06/96   Corrections for sybase debugging
           AEE   02/08/96   use writetext for browse_img
	    NBR   03/11/99   Handle NULL value

 SCCS variables for IDL use
 
 @(#)%w%h	NRL Solar Physics


DEF2C_FILL

[List of Routines] (See ./def2c_fill.pro)

 Project     : SOHO - LASCO/EIT
                   
 Name        : DEF2C_FILL
               
 Purpose     : To convert DB table definition ASCII format to C routine.
               
 Explanation : This routine reads in an ASCII Database table definition file
		and generates a C routine which produces SQL to do inserts.
               
 Use         : IDL> DEF2C_FILL, input_file_name
    
 Inputs      : input_file_name		;file containing DB table definitions
					;TABLE_NAME, TABLE_DESC, TABLE_DEFN
               
 Outputs     : None.
               
 Calls       : STR_SEP2, STR2ARR, ARR2STR, BREAK_FILE, SPEC_DIR

 Common      : None.
               
 Restrictions: Must have write permission for the current directory.
               
 Side effects: Creates two files in the current directory named:
		input_file_name_fill.c
		(the extension is dropped from the input file name)
               
 Category    : Database Administration
               
 Prev. Hist. : None.

 Written     : Dennis Wang, NRL, November 1995.
               
 Modified    : 

 Version     : 


DEF2C_FORMAT

[List of Routines] (See ./def2c_format.pro)

 Project     : SOHO - LASCO/EIT
                   
 Name        : DEF2C_FORMAT
               
 Purpose     : To convert DB table definition ASCII format to C format routine.
               
 Explanation : This routine reads in an ASCII Database table definition file
		and creates a C routine that returns format strings
		for the tables 
               
 Use         : IDL> DEF2C_FORMAT, input_file_name
    
 Inputs      : input_file_name		;file containing DB table definitions
					;TABLE_NAME, TABLE_DESC, TABLE_DEFN, etc...
               
 Outputs     : None.
               
 Calls       : STR_SEP2, STR2ARR, ARR2STR, BREAK_FILE, SPEC_DIR

 Common      : None.
               
 Restrictions: Must have write permission for the current directory.
               
 Side effects: Creates a file in the current directory named:
		input_file_name_format.c
               
 Category    : Database Administration
               
 Prev. Hist. : None.

 Written     : Dennis Wang, NRL, November 2 1995.
               
 Modified    : 

 Version     : 


DEF2C_INSERT

[List of Routines] (See ./def2c_insert.pro)

 Project     : SOHO - LASCO/EIT
                   
 Name        : DEF2C_INSERT
               
 Purpose     : To convert DB table definition ASCII format to C routine.
               
 Explanation : This routine reads in an ASCII Database table definition file
		and generates a C routine which produces SQL to do inserts.
               
 Use         : IDL> DEF2C_INSERT, input_file_name
    
 Inputs      : input_file_name		;file containing DB table definitions
					;TABLE_NAME, TABLE_DESC, TABLE_DEFN, etc...
               
 Outputs     : None.
               
 Calls       : STR_SEP2, STR2ARR, ARR2STR, BREAK_FILE, SPEC_DIR

 Common      : None.
               
 Restrictions: Must have write permission for the current directory.
               
 Side effects: Creates two files in the current directory named:
		input_file_name__ins.c
		(the extension is dropped from the input file name)
               
 Category    : Database Administration
               
 Prev. Hist. : None.

 Written     : Dennis Wang, NRL, November 1995.
               
 Modified    : 

 Version     : 


DEF2STRUCT

[List of Routines] (See ./def2struct.pro)

 Project     : SOHO - LASCO/EIT
                   
 Name        : DEF2STRUCT
               
 Purpose     : To convert DB table definition ASCII format to C and IDL include files.
               
 Explanation : This routine reads in an ASCII Database table definition file
		and creates two output files.  One containing C structure
		defintions for the tables and the other containing IDL structure
		definitions.
               
 Use         : IDL> DEF2STRUCT, input_file_name, database_name
    
 Inputs      : input_file_name		;file containing DB table definitions
					;TABLE_NAME, TABLE_DESC, TABLE_DEFN, etc...
               database_name		;specify the database name that the tables are in
					;this becomes the first element of each struct
               
 Outputs     : None.
               
 Calls       : STR_SEP2, STR2ARR, ARR2STR, BREAK_FILE, SPEC_DIR

 Common      : None.
               
 Restrictions: Must have write permission for the current directory.
               
 Side effects: Creates two files in the current directory named:
		input_file_name_struct.inc	;IDL include file
		input_file_name_struct.h	;C include file
		(the extension is dropped from the input file name)
               
 Category    : Database Administration
               
 Prev. Hist. : None.

 Written     : Scott Paswaters, NRL, October 1995.
               
 Modified    : 

 Version     : 


GET_DB_STRUCT

[List of Routines] (See ./get_db_struct.pro)

 Project     : SOHO - LASCO/EIT
                   
 Name        : GET_DB_STRUCT
               
 Purpose     : To retrieve a structure appropriate for a given database and table.
               
 Explanation : This routine searches through all structures of database table 
		definitions and returns the one matching the input parameters.
               
 Use         : IDL> s = GET_DB_STRUCT('db_name', 'table_name')
               ex. IDL> img_hdr = GET_DB_STRUCT('lasco', 'img_leb_hdr')
    
 Inputs      : db_name		;** Name of Sybase database containing table.
               tab_name	;** Name of DB table you wish to get the struct of.
               
 Outputs     : A structure containing tags of the appropriate type for all fields
		in the table or -1 if none found.
               
 Calls       : INIT_DB_STRUCT, DATATYPE

 Common      : COMMON DB_STRUCT_COMMON, all_db_struct 	;* Defined in INIT_DB_STRUCT
               
 Restrictions: None.
               
 Side effects: None.
               
 Category    : Database Administration
               
 Prev. Hist. : None.

 Written     : Scott Paswaters, NRL, November 1995.
               
 Modified    : 

 Version     : 


INIT_DB_STRUCT

[List of Routines] (See ./init_db_struct.pro)

 Project     : SOHO - LASCO/EIT
                   
 Name        : INIT_DB_STRUCT
               
 Purpose     : To initialize DB table structures from include files.
               
 Explanation : This routine initializes DB table structures from all include
		files and creates a master structure containing them all.
               
 Use         : IDL> INIT_DB_STRUCT
    
 Inputs      : None.
               
 Outputs     : None.
               
 Calls       : GETHELP

 Common      : COMMON DB_STRUCT_COMMON, all_db_struct
               
 Restrictions: None.
               
 Side effects: None.
               
 Category    : Database Administration
               
 Prev. Hist. : None.

 Written     : Scott Paswaters, NRL, November 1995.
               
 Modified    : 13 Jun 1996 SEP Moved include files to ./include subdirectory

 Version     : 1.01


QDB

[List of Routines] (See ./qdb.pro)

 NAME:
	QDB

 PURPOSE:
	Query the LASCO database

 CATEGORY:
	DATABASE

 CALLING SEQUENCE:
	Result = QDB()

 INPUTS:
	None required

 OPTIONAL INPUTS:
	Query:	A string giving the query in boolean form.  If not present a menu will be given
	DB:	A string giving the database to be queried. If not present, 'LASCO' will be used.
	
 OUTPUTS:
	This function returns a structure giving the results of the query.

 PROCEDURE:
	 This function interfaces with a C routine that uses sybase for querying 
	 existing databases. Input to this pro is either two parameters (database
	 name and query command) or nothing. If no parameter is passed, the user
	 is provided with a menu system to form a query command. Output is a 
	 structure containing the selected columns (fields) of the query command
	 as its fields.

 EXAMPLE:
 	Here are some sample calls (first type .run qdb.pro):
 	Input:
 		q= qdb("solwind","select * from transient where date_time > 'Nov 12 1984'")
 		p= qdb("solwind","select * from transient where date_time > '1984/11/12'")
 		r= qdb("solwind","select * from transient where importance = 'A'") 
 		s= qdb("solwind","select height,date_time from transient where height > 10")

		 Note that character strings must be placed in quotation marks such as 
		 'Jul 19 1982' and 'A' and they must be of correct case (upper/lower).

	 Output for s:
		 s.height, s.date_time
		 s.height and s.date_time

	Another example using the menu: 
	 Input:
		 s= qdb()
	 Output:
		 s contains fields selected from the menus

 MODIFICATION HISTORY:
 	Written by:	Ed Esfandiari, Nov 95
			Ed Esfandiari, Feb 96
			 added code to handle sybase "image" data type. Note that "text" type of
			 length > 256 is not handled by this pro"
			Ed Esfandiari, Nov 96
			 added code to recognize LAS's OSF and use lascos in rsh.
                       Ed Esfandiari, Oct 01
                        Changed code to eliminate the use of rsh. Instead of using the
                        sybsrv account on corona, we are now using a copy of db_query_24hr
                        that I have placed in $NRL_LIB/lasco/C/lib.

	@(#)qdb.pro	1.2 03/31/99 LASCO IDL LIBRARY


READ_DOOR_STATUS

[List of Routines] (See ./read_door_status.pro)

 NAME:
	READ_DOOR_STATUS

 PURPOSE:
	Returns an array of the LASCO door status

 CATEGORY:
	DATABASE

 CALLING SEQUENCE:
       Result = READ_DOOR_STATUS()

 INPUTS:
	None

 OUTPUTS:
	This function returns the door status as a structure array with tags:
		.tele	; int (0-3) telescope
		.closed	; double, date closed TAI time format
		.opened	; double, date opened TAI time format

 PROCEDURE:
	Reads lasco/eit door close/open dates from datafile.

 EXAMPLE:
	door_status = READ_DOOR_STATUS()

 MODIFICATION HISTORY:
 	Written by:	Scott Paswaters, NRL, Mar 1998

	@(#)read_door_status.pro	1.2 03/31/99 LASCO IDL LIBRARY


REFORMAT_DATE

[List of Routines] (See ./reformat_date.pro)


 fixed for year 2000 - 2020 AD

 @(#)reformat_date.pro	1.2 01/21/99 : NRL IDL Library

+
 NAME:
	reformat_date

 PURPOSE:
       change dates like m/d/yy to mm/dd/yyyy format.

 CATEGORY:
       Time Utility

 CALLING SEQUENCE:

	RESULT = reformat_date ( date )


 INPUTS:
	date:  string with date in m/d/yy format	

 OPTIONAL INPUTS:
	
 KEYWORD PARAMETERS:

 OUTPUTS:
       returns string in mm/dd/yyyy format

 OPTIONAL OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:
	For years 1951 - 2050 only

 PROCEDURE:

 EXAMPLE:

       datestring='12/1/99'
	result = reformat_date(datestring)

       Produces datestring equal to '12/1/1999'

 MODIFICATION HISTORY:
 	Written by:	Ed Esfandiari -  April 1997
       21 Jan 99 -     Y2k Fix for years 2000-2050 - DW

	@(#)reformat_date.pro	1.2 01/21/99 LASCO IDL LIBRARY


This page was created by IDL lasco_mk_html_help.pro on Wed Aug 17 12:21:33 2005.