diff OrthancServer/Sources/ServerToolbox.cpp @ 5247:eb2684260c19 db-protobuf

support labels for mysql
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Apr 2023 15:44:12 +0200
parents 72dfa0ac84eb
children 1acd709c8772
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerToolbox.cpp	Fri Apr 07 12:20:53 2023 +0200
+++ b/OrthancServer/Sources/ServerToolbox.cpp	Fri Apr 07 15:44:12 2023 +0200
@@ -295,6 +295,13 @@
       {
         return false;
       }
+
+      if (label.size() > 64)
+      {
+        // This limitation is for MySQL, which cannot use a TEXT
+        // column of undefined length as a primary key
+        return false;
+      }
       
       for (size_t i = 0; i < label.size(); i++)
       {
@@ -319,7 +326,8 @@
       {
         throw OrthancException(ErrorCode_ParameterOutOfRange,
                                "A label must be a non-empty, alphanumeric string, "
-                               "possibly with '.', '_', or '-' characters, but got: " + label);
+                               "possibly with '.', '_', or '-' characters, "
+                               "with maximum 64 characters, but got: " + label);
       }
     }
   }