mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
Merge branch '1678-bind-fails-to-build-with-mysql-support-against-mysql8-mysql-connector-8' into 'master'
Resolve "BIND fails to build with MYSQL support against mysql8/mysql-connector-8" Closes #1678 See merge request isc-projects/bind9!3235
This commit is contained in:
@@ -62,6 +62,10 @@
|
|||||||
#include <dlz/sdlz_helper.h>
|
#include <dlz/sdlz_helper.h>
|
||||||
#include <named/globals.h>
|
#include <named/globals.h>
|
||||||
|
|
||||||
|
#if !defined(LIBMARIADB) && MYSQL_VERSION_ID >= 80000
|
||||||
|
typedef bool my_bool;
|
||||||
|
#endif /* !defined(LIBMARIADB) && MYSQL_VERSION_ID >= 80000 */
|
||||||
|
|
||||||
static dns_sdlzimplementation_t *dlz_mysql = NULL;
|
static dns_sdlzimplementation_t *dlz_mysql = NULL;
|
||||||
|
|
||||||
#define dbc_search_limit 30
|
#define dbc_search_limit 30
|
||||||
@@ -759,9 +763,6 @@ mysql_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
char *endp;
|
char *endp;
|
||||||
int j;
|
int j;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
#if MYSQL_VERSION_ID >= 50000
|
|
||||||
my_bool auto_reconnect = 1;
|
|
||||||
#endif /* if MYSQL_VERSION_ID >= 50000 */
|
|
||||||
|
|
||||||
UNUSED(driverarg);
|
UNUSED(driverarg);
|
||||||
UNUSED(dlzname);
|
UNUSED(dlzname);
|
||||||
@@ -897,21 +898,21 @@ mysql_create(const char *dlzname, unsigned int argc, char *argv[],
|
|||||||
pass = getParameterValue(argv[1], "pass=");
|
pass = getParameterValue(argv[1], "pass=");
|
||||||
socket = getParameterValue(argv[1], "socket=");
|
socket = getParameterValue(argv[1], "socket=");
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 50000
|
|
||||||
/* enable automatic reconnection. */
|
/* enable automatic reconnection. */
|
||||||
if (mysql_options((MYSQL *)dbi->dbconn, MYSQL_OPT_RECONNECT,
|
if (mysql_options((MYSQL *)dbi->dbconn, MYSQL_OPT_RECONNECT,
|
||||||
&auto_reconnect) != 0)
|
&(my_bool){ 1 }) != 0)
|
||||||
{
|
{
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_WARNING,
|
DNS_LOGMODULE_DLZ, ISC_LOG_WARNING,
|
||||||
"mysql driver failed to set "
|
"mysql driver failed to set "
|
||||||
"MYSQL_OPT_RECONNECT option, continuing");
|
"MYSQL_OPT_RECONNECT option, "
|
||||||
|
"continuing");
|
||||||
}
|
}
|
||||||
#endif /* if MYSQL_VERSION_ID >= 50000 */
|
|
||||||
|
|
||||||
for (j = 0; dbc == NULL && j < 4; j++)
|
for (j = 0; dbc == NULL && j < 4; j++) {
|
||||||
dbc = mysql_real_connect((MYSQL *)dbi->dbconn, host, user, pass,
|
dbc = mysql_real_connect((MYSQL *)dbi->dbconn, host, user, pass,
|
||||||
dbname, port, socket, flags);
|
dbname, port, socket, flags);
|
||||||
|
}
|
||||||
|
|
||||||
/* let user know if we couldn't connect. */
|
/* let user know if we couldn't connect. */
|
||||||
if (dbc == NULL) {
|
if (dbc == NULL) {
|
||||||
|
@@ -59,6 +59,10 @@
|
|||||||
#include <dlz_minimal.h>
|
#include <dlz_minimal.h>
|
||||||
#include <dlz_pthread.h>
|
#include <dlz_pthread.h>
|
||||||
|
|
||||||
|
#if !defined(LIBMARIADB) && MYSQL_VERSION_ID >= 80000
|
||||||
|
typedef bool my_bool;
|
||||||
|
#endif /* !defined(LIBMARIADB) && MYSQL_VERSION_ID >= 80000 */
|
||||||
|
|
||||||
#define dbc_search_limit 30
|
#define dbc_search_limit 30
|
||||||
#define ALLNODES 1
|
#define ALLNODES 1
|
||||||
#define ALLOWXFR 2
|
#define ALLOWXFR 2
|
||||||
@@ -812,9 +816,6 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
|||||||
char *endp;
|
char *endp;
|
||||||
int j;
|
int j;
|
||||||
const char *helper_name;
|
const char *helper_name;
|
||||||
#if MYSQL_VERSION_ID >= 50000
|
|
||||||
my_bool auto_reconnect = 1;
|
|
||||||
#endif /* if MYSQL_VERSION_ID >= 50000 */
|
|
||||||
#if PTHREADS
|
#if PTHREADS
|
||||||
int dbcount;
|
int dbcount;
|
||||||
int i;
|
int i;
|
||||||
@@ -1012,17 +1013,15 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
|||||||
|
|
||||||
dbc = NULL;
|
dbc = NULL;
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID >= 50000
|
|
||||||
/* enable automatic reconnection. */
|
/* enable automatic reconnection. */
|
||||||
if (mysql_options((MYSQL *)dbi->dbconn, MYSQL_OPT_RECONNECT,
|
if (mysql_options((MYSQL *)dbi->dbconn, MYSQL_OPT_RECONNECT,
|
||||||
&auto_reconnect) != 0)
|
&(my_bool){ 1 }) != 0)
|
||||||
{
|
{
|
||||||
mysql->log(ISC_LOG_WARNING, "MySQL module failed to "
|
mysql->log(ISC_LOG_WARNING, "MySQL module failed to "
|
||||||
"set "
|
"set "
|
||||||
"MYSQL_OPT_RECONNECT "
|
"MYSQL_OPT_RECONNECT "
|
||||||
"option, continuing");
|
"option, continuing");
|
||||||
}
|
}
|
||||||
#endif /* if MYSQL_VERSION_ID >= 50000 */
|
|
||||||
|
|
||||||
for (j = 0; dbc == NULL && j < 4; j++) {
|
for (j = 0; dbc == NULL && j < 4; j++) {
|
||||||
dbc = mysql_real_connect(
|
dbc = mysql_real_connect(
|
||||||
|
@@ -61,6 +61,10 @@
|
|||||||
#include <dlz_minimal.h>
|
#include <dlz_minimal.h>
|
||||||
#include <dlz_pthread.h>
|
#include <dlz_pthread.h>
|
||||||
|
|
||||||
|
#if !defined(LIBMARIADB) && MYSQL_VERSION_ID >= 80000
|
||||||
|
typedef bool my_bool;
|
||||||
|
#endif /* !defined(LIBMARIADB) && MYSQL_VERSION_ID >= 80000 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The SQL queries that will be used for lookups and updates are defined
|
* The SQL queries that will be used for lookups and updates are defined
|
||||||
* here. They will be processed into queries by the build_query()
|
* here. They will be processed into queries by the build_query()
|
||||||
@@ -1020,7 +1024,6 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
|||||||
*/
|
*/
|
||||||
if (mysql_thread_safe()) {
|
if (mysql_thread_safe()) {
|
||||||
for (n = 0; n < MAX_DBI; n++) {
|
for (n = 0; n < MAX_DBI; n++) {
|
||||||
my_bool opt = 1;
|
|
||||||
dlz_mutex_init(&state->db[n].mutex, NULL);
|
dlz_mutex_init(&state->db[n].mutex, NULL);
|
||||||
dlz_mutex_lock(&state->db[n].mutex);
|
dlz_mutex_lock(&state->db[n].mutex);
|
||||||
state->db[n].id = n;
|
state->db[n].id = n;
|
||||||
@@ -1029,7 +1032,7 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
|||||||
mysql_options(state->db[n].sock,
|
mysql_options(state->db[n].sock,
|
||||||
MYSQL_READ_DEFAULT_GROUP, modname);
|
MYSQL_READ_DEFAULT_GROUP, modname);
|
||||||
mysql_options(state->db[n].sock, MYSQL_OPT_RECONNECT,
|
mysql_options(state->db[n].sock, MYSQL_OPT_RECONNECT,
|
||||||
&opt);
|
&(my_bool){ 1 });
|
||||||
dlz_mutex_unlock(&state->db[n].mutex);
|
dlz_mutex_unlock(&state->db[n].mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -887,9 +887,6 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
|
|||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
char *endp;
|
char *endp;
|
||||||
const char *helper_name;
|
const char *helper_name;
|
||||||
#if SQLITE3_VERSION_ID >= 50000
|
|
||||||
my_bool auto_reconnect = 1;
|
|
||||||
#endif /* if SQLITE3_VERSION_ID >= 50000 */
|
|
||||||
#if PTHREADS
|
#if PTHREADS
|
||||||
int dbcount;
|
int dbcount;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
Reference in New Issue
Block a user