mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
[mysql] Remove (auto-)reconnect
MySQL 8.0.34 deprecates `MYSQL_OPT_RECONNECT`. As discussed in #530, this commit is removing library support for (auto-)reconnect. It is of course still possible to reconnect directly using the native handle.
This commit is contained in:
parent
7f04435576
commit
50aa733fec
@ -286,11 +286,6 @@ namespace sqlpp
|
|||||||
return _handle->ping_server();
|
return _handle->ping_server();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reconnect()
|
|
||||||
{
|
|
||||||
return _handle->reconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::shared_ptr<const connection_config>& get_config()
|
const std::shared_ptr<const connection_config>& get_config()
|
||||||
{
|
{
|
||||||
return _handle->config;
|
return _handle->config;
|
||||||
|
@ -42,15 +42,14 @@ namespace sqlpp
|
|||||||
std::string unix_socket;
|
std::string unix_socket;
|
||||||
unsigned long client_flag{0};
|
unsigned long client_flag{0};
|
||||||
std::string charset{"utf8"};
|
std::string charset{"utf8"};
|
||||||
bool auto_reconnect{true};
|
|
||||||
bool debug{false};
|
bool debug{false};
|
||||||
unsigned int connect_timeout_seconds{0}; // 0 = do not override MySQL library default
|
unsigned int connect_timeout_seconds{0}; // 0 = do not override MySQL library default
|
||||||
|
|
||||||
bool operator==(const connection_config& other) const
|
bool operator==(const connection_config& other) const
|
||||||
{
|
{
|
||||||
return (other.host == host and other.user == user and other.password == password and
|
return (other.host == host and other.user == user and other.password == password and
|
||||||
other.database == database and other.charset == charset and other.auto_reconnect == auto_reconnect and
|
other.database == database and other.charset == charset and other.debug == debug and
|
||||||
other.debug == debug and other.connect_timeout_seconds == connect_timeout_seconds);
|
other.connect_timeout_seconds == connect_timeout_seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const connection_config& other) const
|
bool operator!=(const connection_config& other) const
|
||||||
|
@ -79,15 +79,6 @@ namespace sqlpp
|
|||||||
throw sqlpp::exception{"MySQL: could not init mysql data structure"};
|
throw sqlpp::exception{"MySQL: could not init mysql data structure"};
|
||||||
}
|
}
|
||||||
|
|
||||||
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"};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(native_handle(), *config);
|
connect(native_handle(), *config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,10 +105,6 @@ namespace sqlpp
|
|||||||
return mysql_ping(native_handle()) == 0;
|
return mysql_ping(native_handle()) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reconnect()
|
|
||||||
{
|
|
||||||
connect(native_handle(), *config);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace mysql
|
} // namespace mysql
|
||||||
|
Loading…
Reference in New Issue
Block a user