comparison Framework/Common/DatabaseManager.cpp @ 254:8a4ce70f456a

fix crash if connection to server is lost
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Apr 2021 15:33:57 +0200
parents b97a537f4613
children d663d9e44f8d
comparison
equal deleted inserted replaced
253:3bc442765b88 254:8a4ce70f456a
169 169
170 dialect_ = database->GetDialect(); 170 dialect_ = database->GetDialect();
171 } 171 }
172 172
173 173
174 IDatabase& DatabaseManager::GetDatabase()
175 {
176 if (database_.get() == NULL)
177 {
178 throw Orthanc::OrthancException(Orthanc::ErrorCode_DatabaseUnavailable);
179 }
180 else
181 {
182 return *database_;
183 }
184 }
185
186
174 void DatabaseManager::StartTransaction(TransactionType type) 187 void DatabaseManager::StartTransaction(TransactionType type)
175 { 188 {
176 try 189 try
177 { 190 {
178 if (transaction_.get() != NULL) 191 if (transaction_.get() != NULL)