From: Bert Hubert Date: Mon, 23 May 2011 17:27:52 +0000 (+0000) Subject: ease compilation against older mysql libraries X-Git-Tag: auth-3.0~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ee924fb3beec7307caa282191fd5b8694581be0;p=pdns ease compilation against older mysql libraries git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2198 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/modules/gmysqlbackend/smysql.cc b/modules/gmysqlbackend/smysql.cc index 12636f4d2..61ed5930b 100644 --- a/modules/gmysqlbackend/smysql.cc +++ b/modules/gmysqlbackend/smysql.cc @@ -18,9 +18,17 @@ SMySQL::SMySQL(const string &database, const string &host, uint16_t port, const mysql_options(&d_db, MYSQL_READ_DEFAULT_GROUP, "client"); my_bool reconnect = 1; mysql_options(&d_db, MYSQL_OPT_RECONNECT, &reconnect); - unsigned int timeout = 10; - mysql_options(&d_db, MYSQL_OPT_READ_TIMEOUT, &timeout); - mysql_options(&d_db, MYSQL_OPT_WRITE_TIMEOUT, &timeout); + + +#ifdef MYSQL_OPT_READ_TIMEOUT + unsigned int rtimeout = 10; + mysql_options(&d_db, MYSQL_OPT_READ_TIMEOUT, &rtimeout); +#endif +#ifdef MYSQL_OPT_WRITE_TIMEOUT + unsigned int wtimeout = 10; + mysql_options(&d_db, MYSQL_OPT_WRITE_TIMEOUT, &wtimeout); +#endif + if (!mysql_real_connect(&d_db, host.empty() ? 0 : host.c_str(), user.empty() ? 0 : user.c_str(),