Mercurial > hg > orthanc-databases
comparison MySQL/Plugins/MySQLStorageArea.cpp @ 255:d663d9e44f8d
reintroduction of IDatabaseFactory into DatabaseManager
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 14 Apr 2021 17:57:08 +0200 |
parents | 33fa478c119a |
children | 567761f0c1ea |
comparison
equal
deleted
inserted
replaced
254:8a4ce70f456a | 255:d663d9e44f8d |
---|---|
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 MySQLStorageArea::MySQLStorageArea(const MySQLParameters& parameters, | 89 MySQLStorageArea::MySQLStorageArea(const MySQLParameters& parameters, |
90 bool clearAll) | 90 bool clearAll) : |
91 StorageBackend(MySQLDatabase::CreateDatabaseFactory(parameters)) | |
91 { | 92 { |
92 std::unique_ptr<MySQLDatabase> database(MySQLDatabase::OpenDatabaseConnection(parameters)); | |
93 | |
94 if (database.get() == NULL) | |
95 { | 93 { |
96 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); | 94 AccessorBase accessor(*this); |
95 MySQLDatabase& database = dynamic_cast<MySQLDatabase&>(accessor.GetManager().GetDatabase()); | |
96 ConfigureDatabase(database, parameters, clearAll); | |
97 } | 97 } |
98 | |
99 ConfigureDatabase(*database, parameters, clearAll); | |
100 SetDatabase(database.release()); | |
101 } | 98 } |
102 | 99 |
103 | 100 |
104 class MySQLStorageArea::Accessor : public StorageBackend::AccessorBase | 101 class MySQLStorageArea::Accessor : public StorageBackend::AccessorBase |
105 { | 102 { |