Mercurial > hg > orthanc-databases
comparison SQLite/Plugins/SQLiteIndex.cpp @ 199:8cae98f73d53
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 18 Mar 2021 14:52:06 +0100 |
parents | 3236894320d6 |
children | 42990b2dd51b |
comparison
equal
deleted
inserted
replaced
198:7335efde0d23 | 199:8cae98f73d53 |
---|---|
35 namespace OrthancDatabases | 35 namespace OrthancDatabases |
36 { | 36 { |
37 IDatabase* SQLiteIndex::OpenInternal() | 37 IDatabase* SQLiteIndex::OpenInternal() |
38 { | 38 { |
39 uint32_t expectedVersion = 6; | 39 uint32_t expectedVersion = 6; |
40 if (context_) | 40 |
41 { | 41 if (GetContext()) // "GetContext()" can possibly be NULL in the unit tests |
42 expectedVersion = OrthancPluginGetExpectedDatabaseVersion(context_); | 42 { |
43 } | 43 expectedVersion = OrthancPluginGetExpectedDatabaseVersion(GetContext()); |
44 else | |
45 { | |
46 // This case only occurs during unit testing | |
47 expectedVersion = 6; | |
48 } | 44 } |
49 | 45 |
50 // Check the expected version of the database | 46 // Check the expected version of the database |
51 if (expectedVersion != 6) | 47 if (expectedVersion != 6) |
52 { | 48 { |
136 } | 132 } |
137 | 133 |
138 | 134 |
139 SQLiteIndex::SQLiteIndex(const std::string& path) : | 135 SQLiteIndex::SQLiteIndex(const std::string& path) : |
140 IndexBackend(new Factory(*this)), | 136 IndexBackend(new Factory(*this)), |
141 context_(NULL), | |
142 path_(path), | 137 path_(path), |
143 fast_(true) | 138 fast_(true) |
144 { | 139 { |
145 if (path.empty()) | 140 if (path.empty()) |
146 { | 141 { |
149 } | 144 } |
150 | 145 |
151 | 146 |
152 SQLiteIndex::SQLiteIndex() : | 147 SQLiteIndex::SQLiteIndex() : |
153 IndexBackend(new Factory(*this)), | 148 IndexBackend(new Factory(*this)), |
154 context_(NULL), | |
155 fast_(true) | 149 fast_(true) |
156 { | 150 { |
157 } | 151 } |
158 | 152 |
159 | 153 |