diff 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
line wrap: on
line diff
--- a/SQLite/Plugins/SQLiteIndex.cpp	Thu Mar 18 12:24:28 2021 +0100
+++ b/SQLite/Plugins/SQLiteIndex.cpp	Thu Mar 18 14:52:06 2021 +0100
@@ -37,14 +37,10 @@
   IDatabase* SQLiteIndex::OpenInternal()
   {
     uint32_t expectedVersion = 6;
-    if (context_)
+
+    if (GetContext())   // "GetContext()" can possibly be NULL in the unit tests
     {
-      expectedVersion = OrthancPluginGetExpectedDatabaseVersion(context_);
-    }
-    else
-    {
-      // This case only occurs during unit testing
-      expectedVersion = 6;
+      expectedVersion = OrthancPluginGetExpectedDatabaseVersion(GetContext());
     }
 
     // Check the expected version of the database
@@ -138,7 +134,6 @@
 
   SQLiteIndex::SQLiteIndex(const std::string& path) :
     IndexBackend(new Factory(*this)),
-    context_(NULL),
     path_(path),
     fast_(true)
   {
@@ -151,7 +146,6 @@
 
   SQLiteIndex::SQLiteIndex() :
     IndexBackend(new Factory(*this)),
-    context_(NULL),
     fast_(true)
   {
   }