mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-14 11:06:57 +01:00
Merge branch 'poco-1.10.1' into devel
This commit is contained in:
commit
ab3f9dc085
@ -11,6 +11,8 @@ Release 1.10.1 (2020-02-10)
|
||||
- GH #2791: allow pre-allocation of the buffer in Poco::LogStreamBuf.
|
||||
- GH #2816: Modernise TLS configuration
|
||||
- GH #2818: Add getSpecifiedPort() method in Poco::URI.
|
||||
- MySQL: resetting the session when putting it back into a SessionPool is now optional
|
||||
(and disabled by default) due to a bug in MySQL messing up the character encoding when doing so.
|
||||
|
||||
|
||||
Release 1.10.0 (2020-01-27)
|
||||
|
@ -41,19 +41,30 @@ public:
|
||||
static const std::string MYSQL_REPEATABLE_READ;
|
||||
static const std::string MYSQL_SERIALIZABLE;
|
||||
|
||||
SessionImpl(const std::string& connectionString,
|
||||
std::size_t loginTimeout = LOGIN_TIMEOUT_DEFAULT);
|
||||
/// Creates the SessionImpl. Opens a connection to the database
|
||||
SessionImpl(const std::string& connectionString, std::size_t loginTimeout = LOGIN_TIMEOUT_DEFAULT);
|
||||
/// Creates the SessionImpl. Opens a connection to the database.
|
||||
///
|
||||
/// Connection string format:
|
||||
/// <str> == <assignment> | <assignment> ';' <str>
|
||||
/// <assignment> == <name> '=' <value>
|
||||
/// <name> == 'host' | 'port' | 'user' | 'password' | 'db' } 'compress' | 'auto-reconnect'
|
||||
/// <name> == 'host' | 'port' | 'user' | 'password' | 'db' | 'compress' | 'auto-reconnect' | 'reset'
|
||||
/// <value> == [~;]*
|
||||
///
|
||||
/// for compress and auto-reconnect correct values are true/false
|
||||
/// for port - numeric in decimal notation
|
||||
/// The following settings are supported:
|
||||
/// - host: MySQL server hostname or IP address (default: localhost)
|
||||
/// - port: MySQL server port number (default: 3306)
|
||||
/// - user: MySQL user name
|
||||
/// - password: MySQL password
|
||||
/// - compress: enable compression (true/false; default: false)
|
||||
/// - auto-reconnect: enable automatic reconnect (true/false; default: false)
|
||||
/// - secure-auth: use secure authentication (true/false; default: false)
|
||||
/// - character-set: connection character set (default: utf8)
|
||||
/// - reset: reset connection when returned to SessionPool by calling
|
||||
/// mysql_reset_connection().
|
||||
///
|
||||
/// Warning: Due to a bug in MySQL, resetting the connection with mysql_reset_connection()
|
||||
/// could change the character encoding used for the connection. Therefore the
|
||||
/// reset option should be used with caution.
|
||||
|
||||
~SessionImpl();
|
||||
/// Destroys the SessionImpl.
|
||||
@ -182,6 +193,7 @@ private:
|
||||
|
||||
std::string _connector;
|
||||
mutable SessionHandle _handle;
|
||||
bool _reset;
|
||||
bool _connected;
|
||||
bool _inTransaction;
|
||||
bool _failIfInnoReadOnly;
|
||||
|
@ -48,6 +48,7 @@ SessionImpl::SessionImpl(const std::string& connectionString, std::size_t loginT
|
||||
Poco::Data::AbstractSessionImpl<SessionImpl>(connectionString, loginTimeout),
|
||||
_connector("MySQL"),
|
||||
_handle(0),
|
||||
_reset(false),
|
||||
_connected(false),
|
||||
_inTransaction(false),
|
||||
_failIfInnoReadOnly(false),
|
||||
@ -90,6 +91,7 @@ void SessionImpl::open(const std::string& connect)
|
||||
options["auto-reconnect"] = "";
|
||||
options["secure-auth"] = "";
|
||||
options["character-set"] = "utf8";
|
||||
options["reset"] = "";
|
||||
|
||||
const std::string& connString = connectionString();
|
||||
for (std::string::const_iterator start = connString.begin();;)
|
||||
@ -123,14 +125,14 @@ void SessionImpl::open(const std::string& connect)
|
||||
else if (options["compress"] == "false")
|
||||
;
|
||||
else if (!options["compress"].empty())
|
||||
throw MySQLException("create session: specify correct compress option (true or false) or skip it");
|
||||
throw MySQLException("create session: specify correct compress option (true or false)");
|
||||
|
||||
if (options["auto-reconnect"] == "true")
|
||||
_handle.options(MYSQL_OPT_RECONNECT, true);
|
||||
else if (options["auto-reconnect"] == "false")
|
||||
_handle.options(MYSQL_OPT_RECONNECT, false);
|
||||
else if (!options["auto-reconnect"].empty())
|
||||
throw MySQLException("create session: specify correct auto-reconnect option (true or false) or skip it");
|
||||
throw MySQLException("create session: specify correct auto-reconnect option (true or false)");
|
||||
|
||||
#ifdef MYSQL_SECURE_AUTH
|
||||
if (options["secure-auth"] == "true")
|
||||
@ -138,12 +140,19 @@ void SessionImpl::open(const std::string& connect)
|
||||
else if (options["secure-auth"] == "false")
|
||||
_handle.options(MYSQL_SECURE_AUTH, false);
|
||||
else if (!options["secure-auth"].empty())
|
||||
throw MySQLException("create session: specify correct secure-auth option (true or false) or skip it");
|
||||
throw MySQLException("create session: specify correct secure-auth option (true or false)");
|
||||
#endif
|
||||
|
||||
if (!options["character-set"].empty())
|
||||
_handle.options(MYSQL_SET_CHARSET_NAME, options["character-set"].c_str());
|
||||
|
||||
if (options["reset"] == "true")
|
||||
_reset = true;
|
||||
else if (options["reset"] == "false")
|
||||
_reset = false;
|
||||
else if (!options["reset"].empty())
|
||||
throw MySQLException("create session: specify correct reset option (true or false)");
|
||||
|
||||
// Real connect
|
||||
_handle.connect(options["host"].c_str(),
|
||||
options["user"].c_str(),
|
||||
@ -264,8 +273,10 @@ bool SessionImpl::hasTransactionIsolation(Poco::UInt32 ti) const
|
||||
|
||||
void SessionImpl::reset()
|
||||
{
|
||||
if (_connected)
|
||||
if (_connected && _reset)
|
||||
{
|
||||
_handle.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,6 +13,8 @@ AAAIntroduction
|
||||
- GH #2791: allow pre-allocation of the buffer in Poco::LogStreamBuf.
|
||||
- GH #2816: Modernise TLS configuration
|
||||
- GH #2818: Add getSpecifiedPort() method in Poco::URI.
|
||||
- MySQL: resetting the session when putting it back into a SessionPool is now optional
|
||||
(and disabled by default) due to a bug in MySQL messing up the character encoding when doing so.
|
||||
|
||||
|
||||
!!!Release 1.10.0
|
||||
|
Loading…
Reference in New Issue
Block a user