comparison MySQL/Plugins/MySQLIndex.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
47 } 47 }
48 48
49 IDatabase* MySQLIndex::OpenInternal() 49 IDatabase* MySQLIndex::OpenInternal()
50 { 50 {
51 uint32_t expectedVersion = 6; 51 uint32_t expectedVersion = 6;
52 if (context_) 52
53 { 53 if (GetContext()) // "GetContext()" can possibly be NULL in the unit tests
54 expectedVersion = OrthancPluginGetExpectedDatabaseVersion(context_); 54 {
55 } 55 expectedVersion = OrthancPluginGetExpectedDatabaseVersion(GetContext());
56 else
57 {
58 // This case only occurs during unit testing
59 expectedVersion = 6;
60 } 56 }
61 57
62 // Check the expected version of the database 58 // Check the expected version of the database
63 if (expectedVersion != 6) 59 if (expectedVersion != 6)
64 { 60 {
271 } 267 }
272 268
273 269
274 MySQLIndex::MySQLIndex(const MySQLParameters& parameters) : 270 MySQLIndex::MySQLIndex(const MySQLParameters& parameters) :
275 IndexBackend(new Factory(*this)), 271 IndexBackend(new Factory(*this)),
276 context_(NULL),
277 parameters_(parameters), 272 parameters_(parameters),
278 clearAll_(false) 273 clearAll_(false)
279 { 274 {
280 } 275 }
281 276