Mercurial > hg > orthanc-databases
diff Framework/SQLite/SQLiteDatabase.cpp @ 237:35598014f140
refactoring to remove GlobalProperties.cpp
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 08 Apr 2021 19:09:04 +0200 |
parents | b40b30075c51 |
children | 33fa478c119a |
line wrap: on
line diff
--- a/Framework/SQLite/SQLiteDatabase.cpp Thu Apr 08 12:00:01 2021 +0200 +++ b/Framework/SQLite/SQLiteDatabase.cpp Thu Apr 08 19:09:04 2021 +0200 @@ -48,6 +48,9 @@ { class SQLiteImplicitTransaction : public ImplicitTransaction { + private: + SQLiteDatabase& db_; + protected: virtual IResult* ExecuteInternal(IPrecompiledStatement& statement, const Dictionary& parameters) ORTHANC_OVERRIDE @@ -60,6 +63,27 @@ { dynamic_cast<SQLiteStatement&>(statement).ExecuteWithoutResult(*this, parameters); } + + public: + SQLiteImplicitTransaction(SQLiteDatabase& db) : + db_(db) + { + } + + virtual bool DoesTableExist(const std::string& name) ORTHANC_OVERRIDE + { + return db_.GetObject().DoesTableExist(name.c_str()); + } + + virtual bool DoesTriggerExist(const std::string& name) ORTHANC_OVERRIDE + { + return false; + } + + virtual void ExecuteMultiLines(const std::string& query) ORTHANC_OVERRIDE + { + db_.GetObject().Execute(query); + } }; } @@ -68,7 +92,7 @@ switch (type) { case TransactionType_Implicit: - return new SQLiteImplicitTransaction; + return new SQLiteImplicitTransaction(*this); case TransactionType_ReadOnly: case TransactionType_ReadWrite: