changeset 26:cbf322c3c932

check db version
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Jun 2015 11:23:45 +0200
parents 31f2fc2d56ee
children 75203f16ffa5
files CMakeLists.txt Core/Configuration.cpp IndexPlugin/Plugin.cpp
diffstat 3 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Fri May 29 11:32:45 2015 +0200
+++ b/CMakeLists.txt	Thu Jun 04 11:23:45 2015 +0200
@@ -52,7 +52,7 @@
 
 # Check that the Orthanc SDK headers are available or download them
 if (STATIC_BUILD)
-  set(ORTHANC_SDK_URL "http://orthanc.googlecode.com/hg-history/Orthanc-0.8.6")
+  set(ORTHANC_SDK_URL "http://orthanc.googlecode.com/hg-history/Orthanc-0.9.0")
   file(MAKE_DIRECTORY ${AUTOGENERATED_DIR}/orthanc)
   file(DOWNLOAD "${ORTHANC_SDK_URL}/Plugins/Include/OrthancCPlugin.h"
     "${AUTOGENERATED_DIR}/orthanc/OrthancCPlugin.h" SHOW_PROGRESS)
--- a/Core/Configuration.cpp	Fri May 29 11:32:45 2015 +0200
+++ b/Core/Configuration.cpp	Thu Jun 04 11:23:45 2015 +0200
@@ -202,5 +202,4 @@
 
     return false;
   }
-
 }
--- a/IndexPlugin/Plugin.cpp	Fri May 29 11:32:45 2015 +0200
+++ b/IndexPlugin/Plugin.cpp	Thu Jun 04 11:23:45 2015 +0200
@@ -48,6 +48,17 @@
       return -1;
     }
 
+    /* Check the expected version of the database */
+    if (OrthancPluginGetExpectedDatabaseVersion(context_) != 5)
+    {
+      char info[1024];
+      sprintf(info, "This database plugin is incompatible with your version of Orthanc "
+              "expecting the DB schema version %d, but this plugin is compatible with version 5",
+              OrthancPluginGetExpectedDatabaseVersion(context_));
+      OrthancPluginLogError(context_, info);
+      return -1;      
+    }
+
     OrthancPluginSetDescription(context_, "Stores the Orthanc index into a PostgreSQL database.");