Changeset 274f6dc in confclerk_git


Ignore:
Timestamp:
07/22/11 17:33:34 (11 years ago)
Author:
gregor herrmann <gregoa@…>
Branches:
master, qt5
Children:
1dbb3bb
Parents:
7cef62a
Message:

SqlEngine::addRoomToDB: remove event/conference combinations from EVENT_ROOM that are already there.
Should avoid duplicates on updates where the room name changes.
Hopefully fixes ticket #24.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sql/sqlengine.cpp

    r7cef62a r274f6dc  
    262262            //LOG_AUTOTEST(query);
    263263        }
     264        // check if event is already there, i.e. room name changed
     265        query = QSqlQuery(db);
     266        query.prepare("SELECT * FROM EVENT_ROOM WHERE xid_conference=:conference_id AND xid_event=:event_id");
     267        query.bindValue(":conference_id", aRoom["conference_id"]);
     268        query.bindValue(":event_id", aRoom["event_id"]);
     269        if (!query.exec()) qDebug() << "Could not execute SELECT * FROM EVENT_ROOM' query:" << query.lastError();
     270        if(query.next()) // event/conference exists --> delete it
     271        {
     272          query.prepare("DELETE FROM EVENT_ROOM WHERE xid_conference=:conference_id AND xid_event=:event_id");
     273          query.bindValue(":conference_id", aRoom["conference_id"]);
     274          query.bindValue(":event_id", aRoom["event_id"]);
     275          if (!query.exec()) qDebug() << "Could not execute SELECT * FROM EVENT_ROOM' query:" << query.lastError();
     276        }
    264277        query = QSqlQuery(db);
    265278        query.prepare("INSERT INTO EVENT_ROOM (xid_conference,xid_event,xid_room) VALUES (:conference_id, :event_id, :room_id)");
Note: See TracChangeset for help on using the changeset viewer.