Use TransactionRaii in schedulexmlparser.cpp.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 27 Sep 2017 19:34:41 +0000 (21:34 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 27 Sep 2017 19:40:54 +0000 (21:40 +0200)
src/sql/schedulexmlparser.cpp

index 056e0e1..6a4854a 100644 (file)
@@ -45,7 +45,7 @@ void ScheduleXmlParser::parseData(const QByteArray &aData, const QString& url, i
 
     QDomElement scheduleElement = document.firstChildElement("schedule");
 
-    sqlEngine->beginTransaction();
+    TransactionRaii transaction(*sqlEngine); // begins the transaction
 
     QString conference_title;
     if (!scheduleElement.isNull())
@@ -166,8 +166,8 @@ void ScheduleXmlParser::parseData(const QByteArray &aData, const QString& url, i
             } // parsing room elements
         } // parsing day elements
     } // schedule element
-    sqlEngine->commitTransaction();
     if (!conference_title.isNull()) {
+        transaction.commit();
         emit parsingScheduleEnd(conferenceId);
     } else {
         error_message("Could not parse schedule");