changeset 616:dbecea588ef5 find-move-scp

revert to database v3
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Oct 2013 11:06:10 +0200
parents ec0b7a51d7bd
children a24b0161b171
files CMakeLists.txt OrthancServer/DatabaseWrapper.cpp OrthancServer/DatabaseWrapper.h OrthancServer/PrepareDatabase.sql OrthancServer/PrepareDatabaseV4.sql
diffstat 5 files changed, 4 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Thu Oct 24 11:42:46 2013 +0200
+++ b/CMakeLists.txt	Fri Oct 25 11:06:10 2013 +0200
@@ -90,7 +90,6 @@
 # Prepare the embedded files
 set(EMBEDDED_FILES
   PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabase.sql
-  PREPARE_DATABASE_V4 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/PrepareDatabaseV4.sql
   CONFIGURATION_SAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Configuration.json
   LUA_TOOLBOX ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Toolbox.lua
   )
--- a/OrthancServer/DatabaseWrapper.cpp	Thu Oct 24 11:42:46 2013 +0200
+++ b/OrthancServer/DatabaseWrapper.cpp	Fri Oct 25 11:06:10 2013 +0200
@@ -815,27 +815,9 @@
       LOG(INFO) << "Version of the Orthanc database: " << version;
       unsigned int v = boost::lexical_cast<unsigned int>(version);
 
-      // This version of Orthanc is only compatible with versions 3
-      // (Orthanc 0.3.2 to 0.6.1) and 4 (since Orthanc 0.6.2) of the
-      // DB schema
-      ok = (v == 3 || v == 4);
-
-      if (v == 3)
-      {
-        LOG(WARNING) << "Upgrading the database from version 3 to version 4 (reconstructing the index)";
-
-        // Reconstruct the index for case insensitive queries in C-FIND
-        db_.Execute("DROP INDEX IF EXISTS MainDicomTagsIndexValues;");
-        db_.Execute("DROP TABLE IF EXISTS AvailableTags;");
-
-        std::string query;
-        EmbeddedResources::GetFileResource(query, EmbeddedResources::PREPARE_DATABASE_V4);
-        db_.Execute(query);
-
-        db_.Execute("INSERT INTO AvailableTags SELECT DISTINCT tagGroup, tagElement FROM MainDicomTags;");
-
-        //SetGlobalProperty(GlobalProperty_DatabaseSchemaVersion, "4");
-      }
+      // This version of Orthanc is only compatible with version 3 of
+      // the DB schema (since Orthanc 0.3.2)
+      ok = (v == 3);
     }
     catch (boost::bad_lexical_cast&)
     {
@@ -846,8 +828,6 @@
       throw OrthancException(ErrorCode_IncompatibleDatabaseVersion);
     }
 
-    CompleteMainDicomTags();
-
     signalRemainingAncestor_ = new Internals::SignalRemainingAncestor;
     db_.Register(signalRemainingAncestor_);
     db_.Register(new Internals::SignalFileDeleted(listener_));
@@ -1015,11 +995,4 @@
       result.push_back(s.ColumnInt64(0));
     }
   }
-
-
-  void DatabaseWrapper::CompleteMainDicomTags()
-  {
-    std::set<DicomTag> requiredTags;
-    
-  }
 }
--- a/OrthancServer/DatabaseWrapper.h	Thu Oct 24 11:42:46 2013 +0200
+++ b/OrthancServer/DatabaseWrapper.h	Fri Oct 25 11:06:10 2013 +0200
@@ -72,8 +72,6 @@
                               int64_t since,
                               unsigned int maxResults);
 
-    void CompleteMainDicomTags();
-
   public:
     void SetGlobalProperty(GlobalProperty property,
                            const std::string& value);
--- a/OrthancServer/PrepareDatabase.sql	Thu Oct 24 11:42:46 2013 +0200
+++ b/OrthancServer/PrepareDatabase.sql	Fri Oct 25 11:06:10 2013 +0200
@@ -67,6 +67,7 @@
 
 CREATE INDEX MainDicomTagsIndex1 ON MainDicomTags(id);
 CREATE INDEX MainDicomTagsIndex2 ON MainDicomTags(tagGroup, tagElement);
+CREATE INDEX MainDicomTagsIndexValues ON MainDicomTags(value COLLATE BINARY);
 
 CREATE INDEX ChangesIndex ON Changes(internalId);
 
--- a/OrthancServer/PrepareDatabaseV4.sql	Thu Oct 24 11:42:46 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
--- New in database version 4
-CREATE TABLE AvailableTags(
-       tagGroup INTEGER,
-       tagElement INTEGER,
-       PRIMARY KEY(tagGroup, tagElement)
-       );
-
--- Until database version 4, the following index was set to "COLLATE
--- BINARY". This implies case-sensitive searches, but DICOM C-Find
--- requires case-insensitive searches.
--- http://www.sqlite.org/optoverview.html#like_opt
-CREATE INDEX MainDicomTagsIndexValues ON MainDicomTags(value COLLATE NOCASE);