Mercurial > hg > orthanc
changeset 1210:178de5edc0a8 db-changes
comments
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Nov 2014 13:56:17 +0100 |
parents | 25260fe03dd6 |
children | 88511c737760 f7966e9950e4 |
files | OrthancServer/DatabaseWrapper.cpp OrthancServer/main.cpp |
diffstat | 2 files changed, 21 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.cpp Mon Nov 03 17:11:50 2014 +0100 +++ b/OrthancServer/DatabaseWrapper.cpp Tue Nov 04 13:56:17 2014 +0100 @@ -867,6 +867,16 @@ } } + static void UpgradeDatabase(SQLite::Connection& db, + EmbeddedResources::FileResourceId script) + { + std::string upgrade; + EmbeddedResources::GetFileResource(upgrade, script); + db.BeginTransaction(); + db.Execute(upgrade); + db.CommitTransaction(); + } + DatabaseWrapper::DatabaseWrapper(const std::string& path, IServerIndexListener& listener) : @@ -911,9 +921,11 @@ /** * History of the database versions: + * - Orthanc before Orthanc 0.3.0 (inclusive) had no version + * - Version 2: only Orthanc 0.3.1 * - Version 3: from Orthanc 0.3.2 to Orthanc 0.7.2 (inclusive) - * - Version 4: from Orthanc 0.7.3 to Orthanc 0.8.3 (inclusive) - * - Version 5: from Orthanc 0.8.4 (inclusive) + * - Version 4: from Orthanc 0.7.3 to Orthanc 0.8.4 (inclusive) + * - Version 5: from Orthanc 0.8.5 (inclusive) **/ // This version of Orthanc is only compatible with versions 3, 4 and 5 of the DB schema @@ -922,27 +934,20 @@ if (v == 3) { LOG(WARNING) << "Upgrading database version from 3 to 4"; - std::string upgrade; - EmbeddedResources::GetFileResource(upgrade, EmbeddedResources::UPGRADE_DATABASE_3_TO_4); - db_.BeginTransaction(); - db_.Execute(upgrade); - db_.CommitTransaction(); + UpgradeDatabase(db_, EmbeddedResources::UPGRADE_DATABASE_3_TO_4); v = 4; } if (v == 4) { LOG(WARNING) << "Upgrading database version from 4 to 5"; - std::string upgrade; - EmbeddedResources::GetFileResource(upgrade, EmbeddedResources::UPGRADE_DATABASE_4_TO_5); - db_.BeginTransaction(); - db_.Execute(upgrade); - db_.CommitTransaction(); + UpgradeDatabase(db_, EmbeddedResources::UPGRADE_DATABASE_4_TO_5); v = 5; } } catch (boost::bad_lexical_cast&) { + ok = false; } if (!ok)
--- a/OrthancServer/main.cpp Mon Nov 03 17:11:50 2014 +0100 +++ b/OrthancServer/main.cpp Tue Nov 04 13:56:17 2014 +0100 @@ -587,10 +587,14 @@ #if ENABLE_PLUGINS == 1 orthancPlugins.Stop(); + LOG(WARNING) << " Plugins have stopped"; #endif dicomServer.Stop(); + LOG(WARNING) << " DICOM server has stopped"; + httpServer.Stop(); + LOG(WARNING) << " HTTP server has stopped"; } serverFactory.Done();