Lines 92-97
Link Here
|
92 |
*/ |
92 |
*/ |
93 |
|
93 |
|
94 |
/*% |
94 |
/*% |
|
|
95 |
* Factorize the mysql_ping for adding a log error message |
96 |
*/ |
97 |
static isc_result_t |
98 |
mysqldrv_ping(dbinstance_t *dbi) { |
99 |
int pres = 0; |
100 |
|
101 |
pres = mysql_ping(dbi->dbconn); |
102 |
if ( pres != 0 ) { |
103 |
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, |
104 |
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1), |
105 |
"\nMySQL Ping Error : %s (%i)\n", |
106 |
mysql_error(dbi->dbconn), |
107 |
mysql_errno(dbi->dbconn)); |
108 |
return (ISC_R_FAILURE); |
109 |
} |
110 |
return (ISC_R_SUCCESS); |
111 |
} |
112 |
|
113 |
/*% |
95 |
* Allocates memory for a new string, and then constructs the new |
114 |
* Allocates memory for a new string, and then constructs the new |
96 |
* string by "escaping" the input string. The new string is |
115 |
* string by "escaping" the input string. The new string is |
97 |
* safe to be used in queries. This is necessary because we cannot |
116 |
* safe to be used in queries. This is necessary because we cannot |
Lines 225-230
Link Here
|
225 |
} |
244 |
} |
226 |
|
245 |
|
227 |
|
246 |
|
|
|
247 |
mysqldrv_ping(dbi); |
248 |
|
228 |
/* |
249 |
/* |
229 |
* was a zone string passed? If so, make it safe for use in |
250 |
* was a zone string passed? If so, make it safe for use in |
230 |
* queries. |
251 |
* queries. |
Lines 324-330
Link Here
|
324 |
qres = mysql_query((MYSQL *) dbi->dbconn, querystring); |
345 |
qres = mysql_query((MYSQL *) dbi->dbconn, querystring); |
325 |
if (qres == 0) |
346 |
if (qres == 0) |
326 |
break; |
347 |
break; |
327 |
for (j=0; mysql_ping((MYSQL *) dbi->dbconn) != 0 && j < 4; j++) |
348 |
for (j=0; mysqldrv_ping(dbi) != 0 && j < 4; j++) |
328 |
; |
349 |
; |
329 |
} |
350 |
} |
330 |
|
351 |
|
Lines 923-928
Link Here
|
923 |
pass = getParameterValue(argv[1], "pass="); |
944 |
pass = getParameterValue(argv[1], "pass="); |
924 |
socket = getParameterValue(argv[1], "socket="); |
945 |
socket = getParameterValue(argv[1], "socket="); |
925 |
|
946 |
|
|
|
947 |
if(mysql_options((MYSQL *) dbi->dbconn, MYSQL_OPT_RECONNECT, "1")) { |
948 |
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, |
949 |
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR, |
950 |
"Could not set database reconnect option"); |
951 |
} |
952 |
|
926 |
for (j=0; dbc == NULL && j < 4; j++) |
953 |
for (j=0; dbc == NULL && j < 4; j++) |
927 |
dbc = mysql_real_connect((MYSQL *) dbi->dbconn, host, |
954 |
dbc = mysql_real_connect((MYSQL *) dbi->dbconn, host, |
928 |
user, pass, dbname, port, socket, |
955 |
user, pass, dbname, port, socket, |