diff options
author | raczman <none@none> | 2009-03-21 20:42:09 +0100 |
---|---|---|
committer | raczman <none@none> | 2009-03-21 20:42:09 +0100 |
commit | 6354da1eebe58db4d67180e6816ed58e956efa7a (patch) | |
tree | 6a84bd1e461b411348718f5a6cacfef1d368e40a /src/shared/Database/DatabaseMysql.cpp | |
parent | a52405a799d61d85fd2840e79c39887731c04d07 (diff) |
Added MySQL reconnect support, in case of mysql server dying while trinity's running - Thanks to Xeptor for that one.
--HG--
branch : trunk
Diffstat (limited to 'src/shared/Database/DatabaseMysql.cpp')
-rw-r--r-- | src/shared/Database/DatabaseMysql.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/shared/Database/DatabaseMysql.cpp b/src/shared/Database/DatabaseMysql.cpp index 72da1090a85..77a59a69c57 100644 --- a/src/shared/Database/DatabaseMysql.cpp +++ b/src/shared/Database/DatabaseMysql.cpp @@ -167,6 +167,20 @@ bool DatabaseMysql::Initialize(const char *infoString) PExecute("SET NAMES `utf8`"); PExecute("SET CHARACTER SET `utf8`"); + #if MYSQL_VERSION_ID >= 50003 + my_bool my_true = (my_bool)1; + if (mysql_options(mMysql, MYSQL_OPT_RECONNECT, &my_true)) + { + sLog.outDetail("Failed to turn on MYSQL_OPT_RECONNECT."); + } + else + { + sLog.outDetail("Successfully turned on MYSQL_OPT_RECONNECT."); + } + #else + #warning "Your mySQL client lib version does not support reconnecting after a timeout.\nIf this causes you any trouble we advice you to upgrade your mySQL client libs to at least mySQL 5.0.13 to resolve this problem." + #endif + return true; } else |