comparison SQLite/Plugins/IndexPlugin.cpp @ 213:c2e4a909de0e

added IndexBackend::Register() to be used in all the index plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 24 Mar 2021 15:59:23 +0100
parents 821d4ba83dc3
children c8e06b41feec
comparison
equal deleted inserted replaced
212:821d4ba83dc3 213:c2e4a909de0e
64 { 64 {
65 /* Create the database back-end */ 65 /* Create the database back-end */
66 backend_.reset(new OrthancDatabases::SQLiteIndex(context, "index.db")); // TODO parameter 66 backend_.reset(new OrthancDatabases::SQLiteIndex(context, "index.db")); // TODO parameter
67 67
68 /* Register the SQLite index into Orthanc */ 68 /* Register the SQLite index into Orthanc */
69 69 OrthancDatabases::IndexBackend::Register(*backend_);
70 bool hasLoadedV3 = false;
71
72 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1
73 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 9, 2)
74 if (OrthancPluginCheckVersionAdvanced(context, 1, 9, 2) == 1)
75 {
76 OrthancDatabases::DatabaseBackendAdapterV3::Register(*backend_);
77 hasLoadedV3 = true;
78 }
79 # endif
80 #endif
81
82 if (!hasLoadedV3)
83 {
84 OrthancDatabases::DatabaseBackendAdapterV2::Register(*backend_);
85 }
86 } 70 }
87 catch (Orthanc::OrthancException& e) 71 catch (Orthanc::OrthancException& e)
88 { 72 {
89 LOG(ERROR) << e.What(); 73 LOG(ERROR) << e.What();
90 return -1; 74 return -1;