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:

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.