+ // Update storage time as some software uses it...
+ QSqlQuery * updateStorageTimeQuery(new QSqlQuery(db));
+ if(updateStorageTimeQuery != NULL)
+ {
+ updateStorageTimeQuery->setForwardOnly( true );
+
+ if(db.transaction())
+ {
+ try
+ {
+ QString sqlUpdateStorageTime(QString("UPDATE events SET storage_time = start_time WHERE id IN (%1)")
+ .arg(IntsToStringList(InsertedIDs()).join(",")));
+ if (!updateStorageTimeQuery->exec(sqlUpdateStorageTime))
+ {
+ qDebug() << "Query Failed: " << sqlUpdateStorageTime;
+ throw std::exception();
+ }
+
+ qDebug() << "Committing.";
+ db.commit();
+ }
+ catch(...)
+ {
+ qDebug() << "Rolling back.";
+ db.rollback();
+ }
+ }
+ else
+ qDebug() << "Unable to start transaction.";
+ }