comparison PostgreSQL/Plugins/PostgreSQLIndex.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
46 namespace OrthancDatabases 46 namespace OrthancDatabases
47 { 47 {
48 IDatabase* PostgreSQLIndex::OpenInternal() 48 IDatabase* PostgreSQLIndex::OpenInternal()
49 { 49 {
50 uint32_t expectedVersion = 6; 50 uint32_t expectedVersion = 6;
51 if (context_) 51
52 { 52 if (GetContext()) // "GetContext()" can possibly be NULL in the unit tests
53 expectedVersion = OrthancPluginGetExpectedDatabaseVersion(context_); 53 {
54 } 54 expectedVersion = OrthancPluginGetExpectedDatabaseVersion(GetContext());
55 else
56 {
57 // This case only occurs during unit testing
58 expectedVersion = 6;
59 } 55 }
60 56
61 // Check the expected version of the database 57 // Check the expected version of the database
62 if (expectedVersion != 6) 58 if (expectedVersion != 6)
63 { 59 {
261 } 257 }
262 258
263 259
264 PostgreSQLIndex::PostgreSQLIndex(const PostgreSQLParameters& parameters) : 260 PostgreSQLIndex::PostgreSQLIndex(const PostgreSQLParameters& parameters) :
265 IndexBackend(new Factory(*this)), 261 IndexBackend(new Factory(*this)),
266 context_(NULL),
267 parameters_(parameters), 262 parameters_(parameters),
268 clearAll_(false) 263 clearAll_(false)
269 { 264 {
270 } 265 }
271 266