Created
April 26, 2013 11:42
-
-
Save Habbie/5466743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur pdns-3.1.20120804.2690/modules/gmysqlbackend/gmysqlbackend.cc pdns-3.1.20120804.2690.new/modules/gmysqlbackend/gmysqlbackend.cc | |
--- pdns-3.1.20120804.2690/modules/gmysqlbackend/gmysqlbackend.cc 2012-08-04 22:19:20.000000000 +0200 | |
+++ pdns-3.1.20120804.2690.new/modules/gmysqlbackend/gmysqlbackend.cc 2012-09-06 16:26:54.606496190 +0200 | |
@@ -26,7 +26,8 @@ | |
getArgAsNum("port"), | |
getArg("socket"), | |
getArg("user"), | |
- getArg("password"))); | |
+ getArg("password"), | |
+ "pdns"+suffix)); | |
} | |
@@ -44,8 +45,8 @@ | |
void declareArguments(const string &suffix="") | |
{ | |
- declare(suffix,"dbname","Pdns backend database name to connect to","powerdns"); | |
- declare(suffix,"user","Database backend user to connect as","powerdns"); | |
+ declare(suffix,"dbname","Pdns backend database name to connect to",""); | |
+ declare(suffix,"user","Database backend user to connect as",""); | |
declare(suffix,"host","Database backend host to connect to",""); | |
declare(suffix,"port","Database backend port to connect to","0"); | |
declare(suffix,"socket","Pdns backend socket to connect to",""); | |
diff -ur pdns-3.1.20120804.2690/modules/gmysqlbackend/smysql.cc pdns-3.1.20120804.2690.new/modules/gmysqlbackend/smysql.cc | |
--- pdns-3.1.20120804.2690/modules/gmysqlbackend/smysql.cc 2012-08-04 22:19:20.000000000 +0200 | |
+++ pdns-3.1.20120804.2690.new/modules/gmysqlbackend/smysql.cc 2012-09-06 16:26:54.606496190 +0200 | |
@@ -14,15 +14,14 @@ | |
pthread_mutex_t SMySQL::s_myinitlock = PTHREAD_MUTEX_INITIALIZER; | |
SMySQL::SMySQL(const string &database, const string &host, uint16_t port, const string &msocket, const string &user, | |
- const string &password) | |
+ const string &password, const string &group) | |
{ | |
{ | |
Lock l(&s_myinitlock); | |
mysql_init(&d_db); | |
- mysql_options(&d_db, MYSQL_READ_DEFAULT_GROUP, "client"); | |
- my_bool reconnect = 1; | |
#if MYSQL_VERSION_ID >= 50013 | |
+ my_bool reconnect = 1; | |
mysql_options(&d_db, MYSQL_OPT_RECONNECT, &reconnect); | |
#endif | |
@@ -31,12 +30,15 @@ | |
mysql_options(&d_db, MYSQL_OPT_READ_TIMEOUT, &timeout); | |
mysql_options(&d_db, MYSQL_OPT_WRITE_TIMEOUT, &timeout); | |
#endif | |
+ | |
+ mysql_options(&d_db, MYSQL_READ_DEFAULT_GROUP, &group); | |
- if (!mysql_real_connect(&d_db, host.empty() ? 0 : host.c_str(), | |
- user.empty() ? 0 : user.c_str(), | |
- password.empty() ? 0 : password.c_str(), | |
- database.c_str(), port, | |
- msocket.empty() ? 0 : msocket.c_str(), | |
+ if (!mysql_real_connect(&d_db, host.empty() ? NULL : host.c_str(), | |
+ user.empty() ? NULL : user.c_str(), | |
+ password.empty() ? NULL : password.c_str(), | |
+ database.empty() ? NULL : database.c_str(), | |
+ port, | |
+ msocket.empty() ? NULL : msocket.c_str(), | |
CLIENT_MULTI_RESULTS)) { | |
throw sPerrorException("Unable to connect to database"); | |
diff -ur pdns-3.1.20120804.2690/modules/gmysqlbackend/smysql.hh pdns-3.1.20120804.2690.new/modules/gmysqlbackend/smysql.hh | |
--- pdns-3.1.20120804.2690/modules/gmysqlbackend/smysql.hh 2012-08-04 22:19:20.000000000 +0200 | |
+++ pdns-3.1.20120804.2690.new/modules/gmysqlbackend/smysql.hh 2012-09-06 16:26:54.606496190 +0200 | |
@@ -12,8 +12,8 @@ | |
{ | |
public: | |
SMySQL(const string &database, const string &host="", uint16_t port=0, | |
- const string &msocket="",const string &user="", | |
- const string &password=""); | |
+ const string &msocket="",const string &user="", | |
+ const string &password="", const string &group=""); | |
~SMySQL(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment