2581. [contrib] dlz/mysql set MYSQL_OPT_RECONNECT option on connection.

Requires MySQL 5.0.19 or later. [RT #19084]
This commit is contained in:
Mark Andrews
2009-03-26 17:40:15 +00:00
parent cbf7f1435f
commit 9384dc16a1
2 changed files with 17 additions and 0 deletions

View File

@@ -1,3 +1,6 @@
2581. [contrib] dlz/mysql set MYSQL_OPT_RECONNECT option on connection.
Requires MySQL 5.0.19 or later. [RT #19084]
2580. [bug] UpdateRej statistics counter could be incremented twice
for one rejection. [RT #19476]

View File

@@ -792,6 +792,9 @@ mysql_create(const char *dlzname, unsigned int argc, char *argv[],
char *endp;
int j;
unsigned int flags = 0;
#ifdef MYSQL_OPT_RECONNECT
my_bool auto_reconnect = 1;
#endif
UNUSED(driverarg);
UNUSED(dlzname);
@@ -923,6 +926,17 @@ mysql_create(const char *dlzname, unsigned int argc, char *argv[],
pass = getParameterValue(argv[1], "pass=");
socket = getParameterValue(argv[1], "socket=");
#ifdef MYSQL_OPT_RECONNECT
/* enable automatic reconnection. */
if (mysql_options((MYSQL *) dbi->dbconn, MYSQL_OPT_RECONNECT,
&auto_reconnect) != 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_WARNING,
"mysql driver failed to set "
"MYSQL_OPT_RECONNECT option, continuing");
}
#endif
for (j=0; dbc == NULL && j < 4; j++)
dbc = mysql_real_connect((MYSQL *) dbi->dbconn, host,
user, pass, dbname, port, socket,