1 /*************************************************************************** 2 qgsmssqltransaction.h - QgsMssqlTransaction 3 --------------------- 4 begin : 11.3.2021 5 copyright : (C) 2021 by Vincent Cloarec 6 email : vcloarec at gmail dot com 7 *************************************************************************** 8 * * 9 * This program is free software; you can redistribute it and/or modify * 10 * it under the terms of the GNU General Public License as published by * 11 * the Free Software Foundation; either version 2 of the License, or * 12 * (at your option) any later version. * 13 * * 14 ***************************************************************************/ 15 16 #ifndef QGSMSSQLTRANSACTION_H 17 #define QGSMSSQLTRANSACTION_H 18 19 #include "qgstransaction.h" 20 #include <memory> 21 22 class QgsMssqlDatabase; 23 24 25 class QgsMssqlTransaction : public QgsTransaction 26 { 27 Q_OBJECT 28 public: 29 QgsMssqlTransaction( const QString &connString ); 30 ~QgsMssqlTransaction(); 31 32 virtual bool executeSql( const QString &sql, QString &error, bool isDirty = false, const QString &name = QString() ) override; 33 34 QString createSavepoint( const QString &savePointId, QString &error ) override; 35 bool rollbackToSavepoint( const QString &name, QString &error ) override; 36 conn()37 std::shared_ptr<QgsMssqlDatabase> conn() { return mConn; } 38 39 private: 40 virtual bool beginTransaction( QString &error, int statementTimeout ) override; 41 virtual bool commitTransaction( QString &error ) override; 42 virtual bool rollbackTransaction( QString &error ) override; 43 44 private: 45 //! connection is primarily owned by this class, but it may be also shared with QgsMssqlFeatureSource 46 std::shared_ptr<QgsMssqlDatabase> mConn; 47 }; 48 49 50 #endif // QGSMSSQLTRANSACTION_H 51