Home > database > mysql.m

mysql

PURPOSE ^

MYSQL - Interact with a MySQL database server

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 MYSQL - Interact with a MySQL database server

   If no output arguments are given on the left, then display results.
   If arguments are given, then return requested data silently.

   mysql( 'open', host, user, password )
      Open a connection with specified parameters, or defaults if none
            host:  default is local host. Use colon for port number
            user:  default is Unix login name.
        password:  default says connect without password.

       Examples: mysql('open','arkiv')       %  connect on port 0
                 mysql('open','arkiv:2215')

   mysql('close')
      Close the current connection

   mysql('use',db)  or   mysql('use db')
      Set the current database to db   Example:  mysql('use cme')

   mysql('status')  or  mysql()  or mysql   (no arguments)
      Display information about the connection and the server.
      Return    0     if connection is open and functioning
             nonzero  if something is not correct (see code for details)

   mysql( query )
      Send the given query or command to the MySQL server

      With no output arguments on the left side, display the result
      If arguments are given on the left, then each argument
          is set to the column of the returned query.
      Dates and times are converted to Matlab format: dates are
          serial day number, and times are fraction of day.
      String variables are returned as cell arrays.

      Example:
      [ t, p ] = mysql('select time,price,askbid from cme.sp
                  where date="1997-04-30" and expir like "1997-06-%"');
         (but be sure to put quoted text all on one input line)
      Returns time and price for trades on the June 1997 contract
      that occured on April 30, 1997.

   Multiple connections:  The program can maintain up to 10
   independent connections. Any command may be preceded by a
   connection id -- an integer from 0 to 9 -- to apply the
   command to that connection. Default id is zero.
   Example:
      mysql('open','host1')    %  connection 0 to host 1
      mysql(5,'open','host2')  %  connection 5 to host 2
      mysql                    %  status of all connections

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % MYSQL - Interact with a MySQL database server
0002 %
0003 %   If no output arguments are given on the left, then display results.
0004 %   If arguments are given, then return requested data silently.
0005 %
0006 %   mysql( 'open', host, user, password )
0007 %      Open a connection with specified parameters, or defaults if none
0008 %            host:  default is local host. Use colon for port number
0009 %            user:  default is Unix login name.
0010 %        password:  default says connect without password.
0011 %
0012 %       Examples: mysql('open','arkiv')       %  connect on port 0
0013 %                 mysql('open','arkiv:2215')
0014 %
0015 %   mysql('close')
0016 %      Close the current connection
0017 %
0018 %   mysql('use',db)  or   mysql('use db')
0019 %      Set the current database to db   Example:  mysql('use cme')
0020 %
0021 %   mysql('status')  or  mysql()  or mysql   (no arguments)
0022 %      Display information about the connection and the server.
0023 %      Return    0     if connection is open and functioning
0024 %             nonzero  if something is not correct (see code for details)
0025 %
0026 %   mysql( query )
0027 %      Send the given query or command to the MySQL server
0028 %
0029 %      With no output arguments on the left side, display the result
0030 %      If arguments are given on the left, then each argument
0031 %          is set to the column of the returned query.
0032 %      Dates and times are converted to Matlab format: dates are
0033 %          serial day number, and times are fraction of day.
0034 %      String variables are returned as cell arrays.
0035 %
0036 %      Example:
0037 %      [ t, p ] = mysql('select time,price,askbid from cme.sp
0038 %                  where date="1997-04-30" and expir like "1997-06-%"');
0039 %         (but be sure to put quoted text all on one input line)
0040 %      Returns time and price for trades on the June 1997 contract
0041 %      that occured on April 30, 1997.
0042 %
0043 %   Multiple connections:  The program can maintain up to 10
0044 %   independent connections. Any command may be preceded by a
0045 %   connection id -- an integer from 0 to 9 -- to apply the
0046 %   command to that connection. Default id is zero.
0047 %   Example:
0048 %      mysql('open','host1')    %  connection 0 to host 1
0049 %      mysql(5,'open','host2')  %  connection 5 to host 2
0050 %      mysql                    %  status of all connections

Generated on Tue 16-Jul-2019 04:00:51 by m2html © 2003