This is a module for monitoring any data from a MySQL SQL database server (versions 4 and above).

It requires the mysqltcl package to be installed (can be found at http://www.xdobry.de/mysqltcl/).
On Windows platforms, use the odbcquery module instead.

Note: use the odbcquery module instead if you wish to connect to the database via ODBC.

Data is retrieved using the SELECT * FROM table query if a table name is passed as argument using the --t (--table) switch, or using the query passed as argument using the --q (--query) switch (SELECT and SHOW queries work, as may others that return row/column data). Resulting data is initially displayed in 1 table.

Error handling:

When an error occurs (communicating with the database server or any other type), all rows disappear and the displayed table becomes empty. A descriptive error message is also generated in such a case.

Module options:

- --host
  host name or IP address where the database server is running (defaults to localhost).
- -p (--port)
  port used by the database server. 3306 is used internally if not specified.
- -q (--query)
  specifies any valid query (SELECT, SHOW, with table names qualified with their database name using the dot notation, see examples below). Cannot be used along with the table option.
- --swap
  swap rows and columns in displayed table. The database table column names are then displayed vertically in the leftmost column of the displayed table.
- --t (--table)
  specifies the table name (must be qualified with the database name using the dot notation, see examples below). Cannot be used along with the query option.
- --user
  database user name (defaults to current user).
- --password
  database password for user (no default).

Examples:

    $ moodss myquery --host 1.2.3.4 -t test.table
    $ moodss myquery --host dbserver.company.com --port 3307 -t test.table
    $ moodss myquery --host dbserver.company.com --user root --password xxx --table mysql.user
    $ moodss myquery -q 'select * from database.table order by column'
    $ moodss myquery --query 'show variables'

Threads support:

If you use Tcl/Tk 8.4.1 or above with the Tcl Threads package 2.5 or above, then the module will use threads for the database connection. This means that the core (moodss user interface for example) cannot be hung (moodss menus not responding, window not being updated, ...) when the connection with the database is failing.
You can check that moodss actually is in threads mode by looking at the bottom line of the module help window, while moodss is running: a status line will indicate whether threads are in use.