--- dbd/apr_dbd_mysql.c.orig 2026-08-13 17:04:48 +++ dbd/apr_dbd_mysql.c 2026-08-13 17:13:57 @@ -713,10 +713,20 @@ int random, MYSQL_BIND *bind) { int nfields, i; + +#ifdef LIBMYSQL_VERSION_ID +#if MYSQL_VERSION_ID < 60000 my_bool *is_nullr; -#if MYSQL_VERSION_ID >= 50000 + my_bool *error; +#else + bool *is_nullr; + bool *error; +#endif +#else + my_bool *is_nullr; my_bool *error; #endif + int ret; unsigned long *length, maxlen; @@ -737,10 +747,18 @@ if (!(*res)->bind) { (*res)->bind = apr_palloc(pool, nfields*sizeof(MYSQL_BIND)); length = apr_pcalloc(pool, nfields*sizeof(unsigned long)); -#if MYSQL_VERSION_ID >= 50000 +#ifdef LIBMYSQL_VERSION_ID +#if MYSQL_VERSION_ID < 60000 error = apr_palloc(pool, nfields*sizeof(my_bool)); + is_nullr = apr_pcalloc(pool, nfields*sizeof(my_bool)); +#else + error = apr_palloc(pool, nfields*sizeof(bool)); + is_nullr = apr_pcalloc(pool, nfields*sizeof(bool)); #endif +#else + error = apr_palloc(pool, nfields*sizeof(my_bool)); is_nullr = apr_pcalloc(pool, nfields*sizeof(my_bool)); +#endif for ( i = 0; i < nfields; ++i ) { maxlen = ((*res)->res->fields[i].length < sql->fldsz ? (*res)->res->fields[i].length : sql->fldsz) + 1; @@ -754,9 +772,7 @@ (*res)->bind[i].length = &length[i]; (*res)->bind[i].buffer = apr_palloc(pool, maxlen); (*res)->bind[i].is_null = is_nullr+i; -#if MYSQL_VERSION_ID >= 50000 (*res)->bind[i].error = error+i; -#endif } } ret = mysql_stmt_bind_result(statement->stmt, (*res)->bind); @@ -1103,9 +1119,15 @@ size_t klen; const char *value; size_t vlen; -#if MYSQL_VERSION_ID >= 50013 +#ifdef LIBMYSQL_VERSION_ID +#if MYSQL_VERSION_ID < 60000 my_bool do_reconnect = 1; +#else + bool do_reconnect = 1; #endif +#else + my_bool do_reconnect = 1; +#endif MYSQL *real_conn; unsigned long flags = 0; @@ -1174,16 +1196,12 @@ if (fields[8].value != NULL) { mysql_options(sql->conn, MYSQL_READ_DEFAULT_GROUP, fields[8].value); } -#if MYSQL_VERSION_ID >= 50013 if (fields[9].value != NULL) { do_reconnect = atoi(fields[9].value) ? 1 : 0; } -#endif -#if MYSQL_VERSION_ID >= 50013 /* the MySQL manual says this should be BEFORE mysql_real_connect */ mysql_options(sql->conn, MYSQL_OPT_RECONNECT, &do_reconnect); -#endif real_conn = mysql_real_connect(sql->conn, fields[0].value, fields[1].value, fields[2].value, @@ -1198,10 +1216,8 @@ return NULL; } -#if MYSQL_VERSION_ID >= 50013 /* Some say this should be AFTER mysql_real_connect */ mysql_options(sql->conn, MYSQL_OPT_RECONNECT, &do_reconnect); -#endif return sql; } @@ -1262,11 +1278,16 @@ static void dbd_mysql_init(apr_pool_t *pool) { -#if MYSQL_VERSION_ID < 100000 - my_init(); + MYSQL * mysql_init(MYSQL *pool); +#ifdef LIBMYSQL_VERSION_ID +#if MYSQL_VERSION_ID < 60000 + my_bool mysql_thread_init(void); +#else + bool mysql_thread_init(void); #endif - mysql_thread_init(); - +#else + my_bool mysql_thread_init(void); +#endif /* FIXME: this is a guess; find out what it really does */ apr_pool_cleanup_register(pool, NULL, thread_end, apr_pool_cleanup_null); }