Core/Updater: Fix issues when connecting through unix sockets.

* closes #14766
* closes #14759

Signed-off-by: Naios <naios-dev@live.de>
This commit is contained in:
glkrlos
2015-05-27 18:45:16 +02:00
committed by Naios
parent 170794a029
commit fd660d725d

View File

@@ -349,8 +349,27 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos
args.push_back("-h" + host);
args.push_back("-u" + user);
args.push_back("-p" + password);
// Check if we want to connect through ip or socket (Unix only)
#ifdef _WIN32
args.push_back("-P" + port_or_socket);
#else
if (!std::isdigit(port_or_socket[0]))
{
// We can't check here if host == "." because is named localhost if socket option is enabled
args.push_back("-P0");
args.push_back("--protocol=SOCKET");
args.push_back("-S" + port_or_socket);
}
else
// generic case
args.push_back("-P" + port_or_socket);
#endif
// Set the default charset to utf8
args.push_back("--default-character-set=utf8");