# HG changeset patch # User Sebastien Jodogne # Date 1382691970 -7200 # Node ID dbecea588ef57eb1bad71b1a4fa67bda0cae10cf # Parent ec0b7a51d7bd54aaa01ea7dd1e0af72232781d1c revert to database v3 diff -r ec0b7a51d7bd -r dbecea588ef5 CMakeLists.txt --- 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 ) diff -r ec0b7a51d7bd -r dbecea588ef5 OrthancServer/DatabaseWrapper.cpp --- 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(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 requiredTags; - - } } diff -r ec0b7a51d7bd -r dbecea588ef5 OrthancServer/DatabaseWrapper.h --- 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); diff -r ec0b7a51d7bd -r dbecea588ef5 OrthancServer/PrepareDatabase.sql --- 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); diff -r ec0b7a51d7bd -r dbecea588ef5 OrthancServer/PrepareDatabaseV4.sql --- 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);