NAME:
  openmysql
 PURPOSE:
  Open a mySQL database for operations via a pipe.
 DESCRIPTION:
 CATEGORY:
  Database
 CALLING SEQUENCE:
  openmysql,lun,dbname
 INPUTS:
  dbname - Name of database to open at start.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  HOST - host name of the server to connect to for queries.  The default
           is to use the host name specified in your .my.conf configuration
           file.
  USER - user name to be used for the connection.  This is the user name
           as understood by mysql and has no relationship to the user name
           of the calling process.  The default is to use the user name
           specified in your .my.conf configuration file.
  SOCKET - String, identifies socket for client to read and write from.
              default is to not use a socket.
 OUTPUTS:
  lun - the logical unit of the pipe (use free_lun to close).
  error  - return value indicating if the open call succeeded.  If error is
            zero, the open was good and the lun is ready for use.  If error
            is not zero, the lun will not point to an open file and the
            !error_state system variable will contain more information if
            you want it.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
  Assumes that your .my.cnf file points to the correct mysql server and that
    it includes the login information.  Also, the command 'mysql' must appear
    it includes the login information.  Also, the command 'mysql' must appear
    in your default path.
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Lowell Observatory, 2002/01/09
  2006/12/08, MWB, added error output argument, now can indicate if open failed
  2007/09/06, MWB, added HOST/USER keywords
  2010/03/05, MWB, added the EXTRACONFIG keyword
  2011/11/23, Jarle Brinchmann, Leiden Univ., Add SOCKET keyword
                           to support reading from sockets