comparison Framework/Plugins/GlobalProperties.cpp @ 132:5c69c2a14c97 OrthancPostgreSQL-3.2

OrthancPostgreSQL-3.2
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 01 Mar 2019 12:51:37 +0100
parents 714c5d2bee76
children 4cd7e45b671e
comparison
equal deleted inserted replaced
131:90692f9c33e0 132:5c69c2a14c97
113 void SetGlobalProperty(IDatabase& db, 113 void SetGlobalProperty(IDatabase& db,
114 ITransaction& transaction, 114 ITransaction& transaction,
115 Orthanc::GlobalProperty property, 115 Orthanc::GlobalProperty property,
116 const std::string& utf8) 116 const std::string& utf8)
117 { 117 {
118 // This version of "SetGlobalProperty()" (with an explicit
119 // transaction) is called internally by the plugin to set a global
120 // property during the initialization of the database. (TODO:
121 // Could be replaced by the version with an implicit transaction
122 // to avoid code redundancy).
123
118 if (db.GetDialect() == Dialect_SQLite) 124 if (db.GetDialect() == Dialect_SQLite)
119 { 125 {
120 Query query("INSERT OR REPLACE INTO GlobalProperties VALUES (${property}, ${value})", false); 126 Query query("INSERT OR REPLACE INTO GlobalProperties VALUES (${property}, ${value})", false);
121 query.SetType("property", ValueType_Integer64); 127 query.SetType("property", ValueType_Integer64);
122 query.SetType("value", ValueType_Utf8String); 128 query.SetType("value", ValueType_Utf8String);
162 168
163 void SetGlobalProperty(DatabaseManager& manager, 169 void SetGlobalProperty(DatabaseManager& manager,
164 Orthanc::GlobalProperty property, 170 Orthanc::GlobalProperty property,
165 const std::string& utf8) 171 const std::string& utf8)
166 { 172 {
173 // This version of "SetGlobalProperty()" (without an explicit
174 // transaction) is called by Orthanc during its execution. Orthanc
175 // manages the transaction at a higher level, but this transaction
176 // is always present.
177
167 if (manager.GetDialect() == Dialect_SQLite) 178 if (manager.GetDialect() == Dialect_SQLite)
168 { 179 {
169 DatabaseManager::CachedStatement statement( 180 DatabaseManager::CachedStatement statement(
170 STATEMENT_FROM_HERE, manager, 181 STATEMENT_FROM_HERE, manager,
171 "INSERT OR REPLACE INTO GlobalProperties VALUES (${property}, ${value})"); 182 "INSERT OR REPLACE INTO GlobalProperties VALUES (${property}, ${value})");