]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/sql/sqlengine.cpp
changed 'Activity' -> 'Track'
[toast/confclerk.git] / src / sql / sqlengine.cpp
index d0efe13a81ffab66dc6e4a7acbf4cf07679601b9..d74792b862dbf9eab4fd816de6544b8f746b18f5 100644 (file)
@@ -86,24 +86,23 @@ void SqlEngine::addEventToDB(QHash<QString,QString> &aEvent)
 
     if (db.isValid() && db.isOpen())
     {
-        // track/activity has to be handled as the first, since it is necessary to get
-        // track ID from the ACTIVITY table, or to create new ACTIVITY record
+        // track has to be handled as the first, since it is necessary to get
+        // track ID from the TRACK table, or to create new TRACK record
         // and get the ID from newly created record
-        QString queryExist = QString("SELECT id FROM activity WHERE name='%1'").arg(aEvent["track"]);
+        QString queryExist = QString("SELECT id FROM track WHERE name='%1'").arg(aEvent["track"]);
         QSqlQuery resultExist(queryExist,db);
-        // now we have to check whether ACTIVITY record with 'name' exists or not,
-        // - if it doesn't exist yet, then we have to add that record to 'ACTIVITY' table
-        //   and assign autoincremented 'id' to aActivity
-        // - if it exists, then we need to get its 'id' and assign it to aRoom
+        // now we have to check whether TRACK record with 'name' exists or not,
+        // - if it doesn't exist yet, then we have to add that record to 'TRACK' table
+        // - if it exists, then we need to get its 'id'
         int actId = -1;
-        if(resultExist.next()) // ACTIVITY record with 'name' already exists: we need to get its 'id'
+        if(resultExist.next()) // TRACK record with 'name' already exists: we need to get its 'id'
         {
             actId = resultExist.value(0).toInt();
         }
-        else // ACTIVITY record doesn't exist yet, need to create it
+        else // TRACK record doesn't exist yet, need to create it
         {
             QString values = QString("'%1'").arg(aEvent["track"]);
-            QString query = QString("INSERT INTO activity (name) VALUES (%1)").arg(values);
+            QString query = QString("INSERT INTO track (name) VALUES (%1)").arg(values);
             QSqlQuery result (query, db);
             actId = result.lastInsertId().toInt(); // 'id' is assigned automatically
         }
@@ -122,7 +121,7 @@ void SqlEngine::addEventToDB(QHash<QString,QString> &aEvent)
                          .arg("0") \
                          .arg("0");
 
-        QString query = QString("INSERT INTO EVENT (xid_conference, id, start, duration, xid_activity, type, language, favourite, alarm) VALUES (%1)").arg(values);
+        QString query = QString("INSERT INTO EVENT (xid_conference, id, start, duration, xid_track, type, language, favourite, alarm) VALUES (%1)").arg(values);
         QSqlQuery result (query, db);
         //LOG_AUTOTEST(query);
 
@@ -232,7 +231,7 @@ bool SqlEngine::createTables(QSqlDatabase &aDatabase)
             day_change INTEGER, \
             timeslot_duration INTEGER)");
 
-        query.exec("CREATE TABLE ACTIVITY ( \
+        query.exec("CREATE TABLE TRACK ( \
             id INTEGER  PRIMARY KEY AUTOINCREMENT  NOT NULL , \
             name VARCHAR NOT NULL )");
 
@@ -250,14 +249,14 @@ bool SqlEngine::createTables(QSqlDatabase &aDatabase)
             id INTEGER NOT NULL , \
             start INTEGER NOT NULL , \
             duration INTEGER NOT NULL , \
-            xid_activity INTEGER NOT NULL REFERENCES ACTIVITY(id), \
+            xid_track INTEGER NOT NULL REFERENCES TRACK(id), \
             type VARCHAR, \
             language VARCHAR, \
             favourite INTEGER DEFAULT 0, \
             alarm INTEGER DEFAULT 0, \
             PRIMARY KEY (xid_conference,id), \
             FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id) \
-            FOREIGN KEY(xid_activity) REFERENCES ACTIVITY(id))");
+            FOREIGN KEY(xid_track) REFERENCES TRACK(id))");
 
 #ifdef MAEMO
         // TBD: MAEMO Virtual tables compatibility (waiting for Marek).