NAME:
   dequote
 PURPOSE:   (one line only)
   Reconvert a string processed by QUOTE, or from the result of a MySQL query.
 DESCRIPTION:
   In its simplest form this routine will take a string output from QUOTE
   and convert it back to its input. This means removing leading and trailing
   single quotes, and converting "\\" and  "\'" to "\" and "'", respectively.
   If the input string has embedded "\n" strings it will be broken into a
   string array on the "\n" boundaries, with the '\n" themselves removed.
   In this case, the output is a string vector- otherwise, it is a scalar.
   Please note that because QUOTE is a many to one mapping in general,
   the sequence    dequote(quote(x)) returns a string that may not be
   identical to x. (Eg, if x had leading blanks.) However, it should
   be possible to use the output of DEQUOTE with QUOTE again and obtain
   the same results with MySQl.
   Using the /SELECTSQL flag allows quote to be used with the output of 
   mysql queries, particularly in processing  TEXT and BLOB fields. The
   main difference with SELECTSQL set is that embedded "\" and "'" fields are 
   left alone, except for \n which is again assumed to be a line boundary 
   and used to break the string into substring elements.
 CATEGORY:
   Database
 CALLING SEQUENCE:
   result = dequote(string)
 INPUTS:
   string - String to be processed
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  SELECTSQL- Flag, if set some of the processing of dequote is not done,
             specifically removal of backlash characters as escapes.
 OUTPUTS:
   return value is a scalar string, or a string array if the input contained
   the "\n" escape sequence. Back to back "\n" (corresponding to empty lines)
   in the input will result in empty substrings in the array returned.
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 Newlines are currently quoted with two characters: '\n' where the
 n is a literal lower case n. DEQUOTE will not do anything with embedded
 actual newline (012') characters, whether or not they are preceded by '\'.
 Dequote has no equivalent of the LITERAL keyword for quote.
 Dequote does not remove any empty lines- for example,
                       dequote('\n\n\string\n\n')
 returns an array of 4 elements, 3 of which are empty strings.
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Peter L. Collins, 2006/10/27, Lowell Observatory
  2006/12/11, PLC, small bug fix- to return scalar if 1 element.
  2016/10/25, MWB, added support for quoted semi-colon