I did some extensive testing and it looks like that only the first
mysql_ping () fails to reconnect or very possibly returns the wrong
result. I am currently using v4.1.14.
Regards,
Lefteris
----------------------------------------------------
Begin
MySQL is up and running
Restart MySQL and hit enter (reconnect: 1)...
Error: Lost connection to MySQL server during query
Ping 2 Ok!
Ping 3 Ok!
----------------------------------------------------
#include <stdio.h>
#include <mysql.h>
int main ()
{
int i;
char c;
MYSQL mysql;
fprintf (stdout, "Begin\n");
mysql_init (&mysql);
if (!mysql_real_connect (&mysql, "127.0.0.1", "root", "", "test", 0,
NULL, 0))
fprintf (stderr, "Failed to connect to database: Error: %s\n",
mysql_error (&mysql));
else
fprintf (stdout, "MySQL is up and running\n");
mysql.reconnect = 1;
fprintf (stdout, "Restart MySQL and hit enter (reconnect: %d)...",
mysql.reconnect);
c = getchar ();
(void) putc ('\n', stdout);
for (i = 1; i < 4; i++)
if (mysql_ping (&mysql))
fprintf (stderr, "Error: %s\n", mysql_error(&mysql));
else
fprintf (stdout, "Ping %d Ok!\n", i);
return (0);
}
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]