From cd1f88de4b3575b886cd3336ef3cdbbe18aaea19 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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/sqlpp11/mysql/detail/connection_handle.h b/include/sqlpp11/mysql/detail/connection_handle.h index f7f34c00e..0c9981a19 100644 --- a/include/sqlpp11/mysql/detail/connection_handle.h +++ b/include/sqlpp11/mysql/detail/connection_handle.h @@ -79,7 +79,19 @@ 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"}; + } + } +#endif +#else mysql->reconnect = config->auto_reconnect +#endif connect(native_handle(), *config); }