Mercurial > hg > orthanc-databases
comparison SQLite/Plugins/SQLiteIndex.cpp @ 221:73cc85f3d9c1
implementation of the "serverIdentifier" information for global properties
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 Mar 2021 10:40:34 +0200 |
parents | 42990b2dd51b |
children | 94c9908e6aca |
comparison
equal
deleted
inserted
replaced
220:492aa3edf572 | 221:73cc85f3d9c1 |
---|---|
73 | 73 |
74 Orthanc::EmbeddedResources::GetFileResource | 74 Orthanc::EmbeddedResources::GetFileResource |
75 (query, Orthanc::EmbeddedResources::SQLITE_PREPARE_INDEX); | 75 (query, Orthanc::EmbeddedResources::SQLITE_PREPARE_INDEX); |
76 db->Execute(query); | 76 db->Execute(query); |
77 | 77 |
78 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabaseSchemaVersion, expectedVersion); | 78 SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion, expectedVersion); |
79 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, 1); | 79 SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, 1); |
80 } | 80 } |
81 | 81 |
82 t.Commit(); | 82 t.Commit(); |
83 } | 83 } |
84 | 84 |
103 LOG(ERROR) << "Corrupted SQLite database"; | 103 LOG(ERROR) << "Corrupted SQLite database"; |
104 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); | 104 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
105 } | 105 } |
106 | 106 |
107 int version = 0; | 107 int version = 0; |
108 if (!LookupGlobalIntegerProperty(version, *db, t, Orthanc::GlobalProperty_DatabaseSchemaVersion) || | 108 if (!LookupGlobalIntegerProperty(version, *db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabaseSchemaVersion) || |
109 version != 6) | 109 version != 6) |
110 { | 110 { |
111 LOG(ERROR) << "SQLite plugin is incompatible with database schema version: " << version; | 111 LOG(ERROR) << "SQLite plugin is incompatible with database schema version: " << version; |
112 throw Orthanc::OrthancException(Orthanc::ErrorCode_Database); | 112 throw Orthanc::OrthancException(Orthanc::ErrorCode_Database); |
113 } | 113 } |
114 | 114 |
115 int revision; | 115 int revision; |
116 if (!LookupGlobalIntegerProperty(revision, *db, t, Orthanc::GlobalProperty_DatabasePatchLevel)) | 116 if (!LookupGlobalIntegerProperty(revision, *db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel)) |
117 { | 117 { |
118 revision = 1; | 118 revision = 1; |
119 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_DatabasePatchLevel, revision); | 119 SetGlobalIntegerProperty(*db, t, MISSING_SERVER_IDENTIFIER, Orthanc::GlobalProperty_DatabasePatchLevel, revision); |
120 } | 120 } |
121 | 121 |
122 if (revision != 1) | 122 if (revision != 1) |
123 { | 123 { |
124 LOG(ERROR) << "SQLite plugin is incompatible with database schema revision: " << revision; | 124 LOG(ERROR) << "SQLite plugin is incompatible with database schema revision: " << revision; |