]> granicus.if.org Git - pdns/commitdiff
this may _finally_ solve the complaints about 'mysql server has gone away'
authorBert Hubert <bert.hubert@netherlabs.nl>
Mon, 21 Dec 2009 20:33:22 +0000 (20:33 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Mon, 21 Dec 2009 20:33:22 +0000 (20:33 +0000)
Backend error: Failed to execute mysql_query, perhaps connection died? Err=1: MySQL server has gone away
Closes ticket 237

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1461 d19b8d6e-7fed-0310-83ef-9ca221ded41b

modules/gmysqlbackend/smysql.cc

index 329f262bfc52e4c1b5be426e4c0b21519a47b7b9..703aa4cb9d9041389ef122dfe8f3f8df8dc3bf8a 100644 (file)
@@ -16,6 +16,9 @@ SMySQL::SMySQL(const string &database, const string &host, uint16_t port, const
 {
   mysql_init(&d_db);
   mysql_options(&d_db, MYSQL_READ_DEFAULT_GROUP, "client");
+  my_bool reconnect = 1;
+  mysql_options(&d_db, MYSQL_OPT_RECONNECT, &reconnect);
+  
   if (!mysql_real_connect(&d_db, host.empty() ? 0 : host.c_str(), 
                          user.empty() ? 0 : user.c_str(), 
                          password.empty() ? 0 : password.c_str(),