Changeset 51529bd for src/mvc


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.

Location:
src/mvc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/track.cpp

    rcfe9990 r51529bd  
    2121
    2222QString const Track::sTableName = QString("track");
    23 int const Track::sTableColCount = 2;
     23int const Track::sTableColCount = 3;
     24const QString Track::CONFERENCEID = "xid_conference";
    2425const QString Track::NAME = "name";
    2526
    2627QSqlRecord const Track::sColumns = Track::toRecord(QList<QSqlField>()
    2728    << QSqlField("id", QVariant::Int)
     29    << QSqlField(CONFERENCEID, QVariant::Int)
    2830    << QSqlField(NAME, QVariant::String));
    2931
     
    3739{
    3840    QSqlQuery query;
    39     query.prepare("INSERT INTO " + sTableName + " (" + NAME + ")" + " VALUES " + "(\"" + name() + "\")");
     41    query.prepare("INSERT INTO " + sTableName + " (" + CONFERENCEID + "," + NAME + ")" + " VALUES " + "(\"" + QString::number(conferenceid()) + "\",\"" + name() + "\")");
    4042    if (!query.exec())
    4143    {
  • src/mvc/track.h

    rcfe9990 r51529bd  
    2929    static QString const sTableName;
    3030    static const int sTableColCount;
     31    static const QString CONFERENCEID;
    3132    static const QString NAME;
    3233public:
    3334    int id() const { return value("id").toInt(); }
    3435    void setId(int id) { setValue("id", id); }
     36    int conferenceid() const { return value("xid_conference").toInt(); }
     37    void setConference(int conferenceid) { setValue("xid_conference", conferenceid); }
    3538    QString name() const { return value("name").toString(); }
    3639    void setName(const QString & type) { setValue("name", type); }
Note: See TracChangeset for help on using the changeset viewer.