diff Framework/MySQL/MySQLParameters.cpp @ 46:6a574d810b98

Compatibility with MySQL 8.0
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Jul 2018 12:27:40 +0200
parents b2ff1cd2907a
children 89a114f36c42
line wrap: on
line diff
--- a/Framework/MySQL/MySQLParameters.cpp	Tue Jul 17 08:50:53 2018 +0200
+++ b/Framework/MySQL/MySQLParameters.cpp	Wed Jul 18 12:27:40 2018 +0200
@@ -33,7 +33,13 @@
     password_.clear();
     database_.clear();
     port_ = 3306;
+
+#if defined(_WIN32)
+    unixSocket_.clear();
+#else
     unixSocket_ = "/var/run/mysqld/mysqld.sock";
+#endif
+    
     lock_ = true;
   }
 
@@ -106,7 +112,7 @@
   {
     if (database.empty())
     {
-      LOG(ERROR) << "Empty database name";
+      LOG(ERROR) << "MySQL: Empty database name";
       throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
     }
     
@@ -114,8 +120,8 @@
     {
       if (!isalnum(database [i]))
       {
-        LOG(ERROR) << "Only alphanumeric characters are allowed in a "
-                   << "MySQL database name: \"" << database << "\"";
+        LOG(ERROR) << "MySQL: Only alphanumeric characters are allowed in a "
+                   << "database name: \"" << database << "\"";
         throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);          
       }
     }
@@ -139,6 +145,13 @@
   
   void MySQLParameters::SetUnixSocket(const std::string& socket)
   {
+#if defined(_WIN32)
+    if (!socket.empty())
+    {
+      LOG(WARNING) << "MySQL: Setting an UNIX socket on Windows has no effect";
+    }
+#endif
+    
     unixSocket_ = socket;
   }