diff --git a/include/sqlpp11/mysql/detail/connection_handle.h b/include/sqlpp11/mysql/detail/connection_handle.h index f7f34c00e..43b66a79f 100644 --- a/include/sqlpp11/mysql/detail/connection_handle.h +++ b/include/sqlpp11/mysql/detail/connection_handle.h @@ -79,7 +79,18 @@ namespace sqlpp throw sqlpp::exception{"MySQL: could not init mysql data structure"}; } +#if MYSQL_VERSION_ID < 80034 + if (config->auto_reconnect) + { + my_bool my_true{true}; + if (mysql_options(native_handle(), MYSQL_OPT_RECONNECT, &my_true)) + { + throw sqlpp::exception{"MySQL: could not set option MYSQL_OPT_RECONNECT"}; + } + } +#else mysql->reconnect = config->auto_reconnect +#endif connect(native_handle(), *config); }