comparison 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
comparison
equal deleted inserted replaced
83:ff2d56d37bfd 84:b96446b8718b
114 { 114 {
115 revision = 1; 115 revision = 1;
116 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision); 116 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
117 } 117 }
118 118
119 if (revision != 1) 119 if (revision == 1)
120 {
121 // The serialization of jobs as a global property can lead to
122 // very long values => switch to the LONGTEXT type that can
123 // store up to 4GB:
124 // https://stackoverflow.com/a/13932834/881731
125 db->Execute("ALTER TABLE GlobalProperties MODIFY value LONGTEXT", false);
126
127 revision = 2;
128 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision);
129 }
130
131 if (revision != 2)
120 { 132 {
121 LOG(ERROR) << "MySQL plugin is incompatible with database schema revision: " << revision; 133 LOG(ERROR) << "MySQL plugin is incompatible with database schema revision: " << revision;
122 throw Orthanc::OrthancException(Orthanc::ErrorCode_Database); 134 throw Orthanc::OrthancException(Orthanc::ErrorCode_Database);
123 } 135 }
124 136