From ffc5a27992bbb735e76df48009c63ad7b0a48870 Mon Sep 17 00:00:00 2001 From: damian-tomczak Date: Mon, 25 Sep 2023 11:05:44 +0200 Subject: [PATCH] review fix --- include/sqlpp11/mysql/detail/connection_handle.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/sqlpp11/mysql/detail/connection_handle.h b/include/sqlpp11/mysql/detail/connection_handle.h index f7f34c00..43b66a79 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); }