From: Javi <ja...@gs...> - 2004-03-20 18:20:20
Attachments:
lcd4linux.conf
plugin_mysql.c
|
Hi all. I enclose an improved version of MySQL plugin. New features: -Now MySQL plugin is configured through a MySQL section in lcd4linux.conf. (See sample lcd4linux.conf attached) -It uses persistent connections: connect on init and disconnect on exit. -Connection trackin: It checks whether the connection to the server is working. If it has gone down, an automatic reconnection is attempted. TO DO list : -Add a function to fetch data (not only the number of rows) from the database. -MySQLquery() function should allow either one or two arguments, if there is only one, use the database value from the config file, if there are two, use the second one as the new database name. -Add an argument to mySQLstatus funtion. The argument will indicate what to return:Uptime, Threads, Questions,Slow queries, Flush tables,... If uptime, return it Like: Days,hours,minutes Please send comments and feedback. Bye Javi. |
From: Michael R. <re...@eu...> - 2004-03-20 23:25:32
|
Hi Javi, > I enclose an improved version of MySQL plugin. Fine! Already checked in into CVS, but with some modifications: - The config section is no longer called "MySQL", but "Plugin MySQL" (take a look at lcd4linux.conf.sample) - I put all section references into a global variable "Section" - I modified some of the config info/error messages to emit the correct section. - I prepared some SQL examples in the lcd4linux.conf.sample - I enclosed the MySQL-Exit function between #ifdef HAVE_MYSQL_H I hope this works, because I cannot test it... > TO DO list : > -Add a function to fetch data (not only the number of rows) from the database. > -MySQLquery() function should allow either one or two arguments, > if there is only one, use the database value from the config file, if there are two, > use the second one as the new database name. > -Add an argument to mySQLstatus funtion. > The argument will indicate what to return:Uptime, Threads, Questions,Slow queries, Flush tables,... > If uptime, return it Like: Days,hours,minutes The most imnportant thing would be a better autoconf makro which does not only check for mysql.h, but for libmyslq, too, and add this library to the CFLAGS or LFLAGS. Anybody out there who has experience with this? Anybody out there who uses programs which have a "soft dependency" to MySQL? Take a look into the configure.in and Makefile.am, maybe we can steal^H^H^H^H^Hadopt some code... bye, Michael -- Michael Reinelt Tel: +43 676 3079941 Geisslergasse 4 Fax: +43 316 692343 A-8045 Graz, Austria e-mail: re...@eu... |
From: Javi <ja...@gs...> - 2004-03-21 13:15:06
Attachments:
patch.txt
|
Hi Michael, hi all. > Fine! Already checked in into CVS, but with some modifications: >... > - I prepared some SQL examples in the lcd4linux.conf.sample > I hope this works, because I cannot test it... All works fine with some minor changes in sample.conf. See patch.txt > The most imnportant thing would be a better autoconf makro which does > not only check for mysql.h, but for libmyslq, too, and add this library > to the CFLAGS or LFLAGS. I don't know about using Automake and Autoconf, but googleing I've found that,hope that it helps: (http://www.murrayc.com/learning/linux/using_libraries/using_libraries.shtml) Libraries with no macro and no script: There are still many libraries which do not use *-config scripts or macros to make your life easier. The best thing to do in this situation is to allow the user to tell the configure script where to find the library. You can do this with the AM_ARG_WITH() macro. This adds a command line argument to the configure script and complains if it isn't used. For instance: # Ask user for path to libmysqlclient stuff:. AC_ARG_WITH(mysql, [ --with-mysql=<path> prefix of MySQL installation. e.g. /usr/local or /usr], [MYSQL_PREFIX=$with_mysql], AC_MSG_ERROR([You must call configure with the --with-mysql option. This tells configure where to find the MySql C library and headers. e.g. --with-mysql=/usr/local or --with-mysql=/usr]) ) AC_SUBST(MYSQL_PREFIX) MYSQL_LIBS="-L${MYSQL_PREFIX}/lib/mysql -lmysqlclient" MYSQL_CFLAGS="-I${MYSQL_PREFIX}/include" AC_SUBST(MYSQL_LIBS) AC_SUBST(MYSQL_CFLAGS) Bye Javi |
From: Michael R. <re...@eu...> - 2004-03-21 23:00:56
|
Hi Javi, > All works fine with some minor changes in sample.conf. See patch.txt Checked in, thanks. >>The most imnportant thing would be a better autoconf makro which does >>not only check for mysql.h, but for libmyslq, too, and add this library >>to the CFLAGS or LFLAGS. > I don't know about using Automake and Autoconf, but googleing I've found that,hope that it helps: This is not very clean. The solution I'd prefer would be completely transparent to the user, which means it would sook at several places for the header and library, if found, modify CFLAGS and LFLAGS accordingly, and define a symbol HAVE_MYSQL or so. If it doesn't find either header or lib, do nothing but undefine HAVE_MYSQL. I posted a question to a MySQL Newsgroup, maybe someone has already worked this one out. I found a sample solution within the source of "motion", but this doesn't look very clean to me, too. bye, Michael -- Michael Reinelt Tel: +43 676 3079941 Geisslergasse 4 Fax: +43 316 692343 A-8045 Graz, Austria e-mail: re...@eu... |