Mercurial > hg > orthanc-databases
diff MySQL/Plugins/MySQLIndex.cpp @ 84:b96446b8718b
Fix serialization of jobs if many of them
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Jan 2019 15:25:02 +0100 |
parents | 714c5d2bee76 |
children | 48d445f756db |
line wrap: on
line diff
--- a/MySQL/Plugins/MySQLIndex.cpp Thu Jan 10 14:51:51 2019 +0100 +++ b/MySQL/Plugins/MySQLIndex.cpp Thu Jan 10 15:25:02 2019 +0100 @@ -116,7 +116,19 @@ SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision); } - if (revision != 1) + if (revision == 1) + { + // The serialization of jobs as a global property can lead to + // very long values => switch to the LONGTEXT type that can + // store up to 4GB: + // https://stackoverflow.com/a/13932834/881731 + db->Execute("ALTER TABLE GlobalProperties MODIFY value LONGTEXT", false); + + revision = 2; + SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision); + } + + if (revision != 2) { LOG(ERROR) << "MySQL plugin is incompatible with database schema revision: " << revision; throw Orthanc::OrthancException(Orthanc::ErrorCode_Database);