>  Docs Center  >  Libraries  >  Buie  >  MYSQLQUERY
Libraries

MYSQLQUERY

MYSQLQUERY

Name


  mysqlquery

Purpose


  Submit MySQL query and get response as vectors of data (like readcol).

Description


  Submit a simple SQL query to MySQL server, using the connection
  previously opened with openmysql. Retrieve the result into
  a row of variables, much as readcol does. Return dimensionality
  of result(s).

Category


  Database

Calling Sequence


  mysqlquery,lun,query,[varables...],[format='(a,f,...)']

Inputs


    lun - The logical unit of the pipe (opened by openmysql).
    query - String (or array of strings) to send to pipe.

Optional Input Parameters


Keyword Input Parameters


    format - Specify format of output variables (default is ascii).
    cmd - Flag indicating this is a command, not a query so
                don't bother processing the output (but do report the
                number of rows affected/warnings? - not implimented).
    verbose - Flag turns on debugging output to standard out.

Outputs


    variables - A list of variables to recieve columns of output.
                  Default type is ascii, but use the format keyword to
                  specify other data types.

Keyword Output Parameters


    HEADS - String to receive array of column heads.
    NGOOD - Number of valid lines found that were read.

Common Blocks


Side Effects


Restrictions


  Requires an open connection to MySQL server (established by
  use of openmysql) as well as valid permissions for whatever
  query or command is to be executed.

Procedure


Modification History


  2002-02-14 Will Grundy, adapted from earlier version called mysql.pro
  2002-02-27 WG changed behavior so 'NULL' becomes NaN instead of
                  making the line be ignored when it occurs in a numerical
                  field.
  2002-03-25 WG changed to split on tab instead of white space, so that
      strings with internal spaces (but not tabs) can be retrieved.
  2003/01/10, MWB, fixed multi-line query error. Only one query per
                      call is allowed.
  2006/11/09, PLC, changed strsplit call to use /preserve_null flag
                    this means a field can now return an empty string.
                    The behavior for non-'a' type fields is not defined
                    in this case.
  2007/07/15, MWB, added NGOOD output keyword
  2010/03/11, MWB, change behavior so that if there is only one valid
                    line the result is returned as a scalar instead of
                    a one-element vector.
  2014/03/07, MWB, increased number of returned variables to 35.
  2016/11/14, MWB, fix to LL format code handling, propagated from readcol
  BUGS/WISH LIST:
  Ought to verify connection to MySQL server.
  Does nothing helpful with SQL command results.
  Does nothing helpful to identify/report bad SQL syntax.



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us