projects
/
NeonServV5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
77a6e8f
)
reconnect to mysql if disconnected
author
pk910
<philipp@zoelle1.de>
Sun, 11 Sep 2011 11:06:27 +0000
(13:06 +0200)
committer
pk910
<philipp@zoelle1.de>
Sun, 11 Sep 2011 11:17:24 +0000
(13:17 +0200)
mysqlConn.c
patch
|
blob
|
history
mysqlConn.h
patch
|
blob
|
history
diff --git
a/mysqlConn.c
b/mysqlConn.c
index 53b50e995ce3f495c435a94bcc69b52446b07533..66494e7f5055cf333db9d500c9bde2a605c7f2cd 100644
(file)
--- a/
mysqlConn.c
+++ b/
mysqlConn.c
@@
-16,9
+16,16
@@
static struct used_result *used_results;
static struct escaped_string *escaped_strings;
void check_mysql() {
- if(mysql_ping(mysql_conn)) {
- //mysql error
- show_mysql_error();
+ int errid;
+ if((errid = mysql_ping(mysql_conn))) {
+ if(mysql_errno(mysql_conn) == CR_SERVER_GONE_ERROR) {
+ if(!mysql_real_connect(mysql_conn, MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_BASE, MYSQL_PORT, NULL, 0)) {
+ show_mysql_error();
+ }
+ } else {
+ //mysql error
+ show_mysql_error();
+ }
}
}
diff --git
a/mysqlConn.h
b/mysqlConn.h
index f456471b6444ccab62186a3da059455286bec282..4ed66558136797691052986110fe3a1ee555ee1b 100644
(file)
--- a/
mysqlConn.h
+++ b/
mysqlConn.h
@@
-3,6
+3,7
@@
#include "main.h"
#include <mysql.h>
+#include <mysql/errmsg.h>
#define MYSQLMAXLEN 1024