Changeset 51529bd for src/sql


Ignore:
Timestamp:
06/22/11 19:51:30 (11 years ago)
Author:
gregor herrmann <gregoa@…>
Branches:
master, qt5
Children:
f657e9c
Parents:
cfe9990
Message:

Insert new field xid_conference into table track, room and person.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sql/sqlengine.cpp

    rcfe9990 r51529bd  
    132132    {
    133133        //insert event track to table and get track id
     134        int conference = aEvent["conference_id"].toInt();
    134135        QString name = aEvent["track"];
    135136        Track track;
     
    142143        }
    143144        catch (OrmNoObjectException &e) {
     145            track.setConference(conference);
    144146            track.setName(name);
    145147            trackId = track.insert();
     
    212214    if (db.isValid() && db.isOpen())
    213215    {
    214         QString values = QString("'%1', '%2'").arg(aPerson["id"],aPerson["name"]);
    215         QString query = QString("INSERT INTO PERSON (id,name) VALUES (%1)").arg(values);
     216        QString values = QString("'%1', '%2', '%3'").arg(aPerson["conference_id"],aPerson["id"],aPerson["name"]);
     217        QString query = QString("INSERT INTO PERSON (xid_conference,id,name) VALUES (%1)").arg(values);
    216218        QSqlQuery result (query, db);
    217219        //LOG_AUTOTEST(query);
     
    243245        else // ROOM record doesn't exist yet, need to create it
    244246        {
    245             QString values = QString("'%1', '%2'").arg(aRoom["name"],aRoom["picture"]);
    246             QString query = QString("INSERT INTO ROOM (name,picture) VALUES (%1)").arg(values);
     247            QString values = QString("'%1', '%2', '%3'").arg(aRoom["conference_id"],aRoom["name"],aRoom["picture"]);
     248            QString query = QString("INSERT INTO ROOM (xid_conference,name,picture) VALUES (%1)").arg(values);
    247249            QSqlQuery result (query, db);
    248250            roomId = result.lastInsertId().toInt(); // 'id' is assigned automatically
Note: See TracChangeset for help on using the changeset viewer.