Tracks are inserted now when importing new conferences.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Thu, 23 Jun 2011 06:57:20 +0000 (06:57 +0000)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Thu, 23 Jun 2011 06:57:20 +0000 (06:57 +0000)
src/mvc/track.cpp
src/mvc/track.h
src/sql/sqlengine.cpp

index 9cadb47..5451378 100644 (file)
@@ -50,12 +50,13 @@ int Track::insert()
         throw TrackInsertException("Last Insert Id Error");
 }
 
-Track Track::retrieveByName(QString name)
+Track Track::retrieveByName(int conferenceid, QString name)
 {
     QSqlQuery query;
     query.prepare(
             selectQuery()
-            + QString("WHERE %1.name = :name").arg(sTableName));
+            + QString("WHERE %1.xid_conference = :xid_conference and %1.name = :name").arg(sTableName));
+    query.bindValue(":xid_conference", conferenceid);
     query.bindValue(":name", name);
     return loadOne(query);
 }
index 3173b87..16a6b98 100644 (file)
@@ -42,7 +42,7 @@ public:
     static QList<Track> getAll();
     static Track retrieve(int id);
     static QString retrieveTrackName(int id);
-    static Track retrieveByName(QString name);
+    static Track retrieveByName(int conferenceid, QString name);
 };
 
 #endif /* TRACK_H_ */
index 56f4477..a846c07 100644 (file)
@@ -140,7 +140,7 @@ void SqlEngine::addEventToDB(QHash<QString,QString> &aEvent)
         int trackId;
         try
         {
-            track = Track::retrieveByName(name);
+            track = Track::retrieveByName(conference, name);
             trackId = track.id();
             /*qDebug() << QString("DEBUG: Track %1 in DB").arg(name);*/
         }