diff 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
line wrap: on
line diff
--- a/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Thu Mar 18 12:24:28 2021 +0100
+++ b/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Thu Mar 18 14:52:06 2021 +0100
@@ -48,14 +48,10 @@
   IDatabase* PostgreSQLIndex::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
@@ -263,7 +259,6 @@
 
   PostgreSQLIndex::PostgreSQLIndex(const PostgreSQLParameters& parameters) :
     IndexBackend(new Factory(*this)),
-    context_(NULL),
     parameters_(parameters),
     clearAll_(false)
   {