FUNCTION getSQLServer

;;-----------------------------------------------------------------------------
;; PURPOSE:
;;	Reads the "dical.config" file to determine which SQL servers to query.
;;	Multiple servers can be specified because sqlServer structure 
;;	contains a field called "next" which points to the next SQL server
;;	to query if this one failed.
;;
;;	!!!!WARNING!!!! Don't forget to delete the linked list when done. This
;;	can be done using the freeLinkedList procedure. If the list is not 
;;	deleted, it will continue to exist in the heap and cause memory errors.
;;
;; CALLING SEQUENCE:
;;	RESULT = getSQLServer()
;;
;; REQUIRED INPUTS:
;;	none
;;
;; OUTPUTS:
;;	RETURN - A pointer to the first sqlServer structure in this list which
;;		contains information about how to access the database
;;
;; OPTIONAL INPUT KEYWORDS:
;;
;; EXAMPLE:
;;      IDL> sqlServ = getSQLServer()
;;
;; PROCEDURES USED (i.e. called directly!):
;;	getDICalConfig
;;
;; MODIFICATION HISTORY:
;;   	2004-06-04  M. Desnoyer - Created
;;	2004-08-05  M. Desnoyer - Added support to specify backup databases
;;	2004-09-27  M. Desnoyer - Changed the way servers are stored to a 
;;				linked list
;;
;;-----------------------------------------------------------------------------

ON_ERROR, 2

config = getDICalConfig()

IF NOT ptr_valid(config.sqlServers) THEN $
	message, 'Invalid configuration: A SQL server must be specified'

RETURN, config.sqlServers

END