Changeset 20a6010 for src/model/event.h


Ignore:
Timestamp:
12/30/09 14:50:23 (13 years ago)
Author:
komarma <komarma@…>
Branches:
master, qt5
Children:
489f262
Parents:
5a73d27
Message:

Adding database loading and data conversion to orm module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/model/event.h

    r5a73d27 r20a6010  
    1616};
    1717
    18 class Event : public OrmRecord <Event>
     18class Event : public OrmRecord<Event>
    1919{
    2020public:
    21     // column definition
    22     enum Column
    23     {
    24         Id = 0,
    25         Conference,
    26         Start,
    27         Duration,
    28         Activity,
    29         Type,
    30         Language
    31     };
    32 
    33     static QStringList const sColNames;
    34 
     21    static QSqlRecord const sColumns;
    3522    static QString const sTableName;
    3623
    3724public:
    38     static Event getById(int id, int conferenceId) { return Event(); } //EventTable::selectOne("id=1"); }
     25    static Event getById(int id, int conferenceId);
    3926
    4027public:
    41     int id() const { return value(Id).toInt(); }
    42     int conferenceId() const { return value(Conference).toInt(); }
    43     QDateTime start() const { return value(Start).toDateTime(); }
    44     int duration() const { return value(Duration).toInt(); }
    45     int activityId() const { return value(Activity).toInt(); }
    46     int typeId() const { return value(Type).toInt(); }
    47     int languageId() const { return value(Language).toInt(); }
     28    int id() const { return value("id").toInt(); }
     29    int conferenceId() const { return value("xid_conference").toInt(); }
     30    QDateTime start() const { return value("start").toDateTime(); }
     31    int duration() const { return value("duration").toInt(); }
     32    int activityId() const { return value("xid_activity").toInt(); }
     33    int typeId() const { return value("type").toInt(); }
     34    int languageId() const { return value("language").toInt(); }
    4835
    49     void setId(int id) { setValue(Id, id); }
    50     void setConferenceId(int conferenceId) { setValue(Conference, conferenceId); }
    51     void setStart(const QDateTime& start) { setValue(Start, start); }
    52     void setDuration(int duration) { setValue(Duration, duration); }
    53     void setActivityId(int activityId) { setValue(Activity, activityId); }
    54     void setTypeId(int typeId) { setValue(Type, typeId); }
    55     void setLanguageId(int languageId) { setValue(Language, languageId); }
     36    void setId(int id) { setValue("id", id); }
     37    void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
     38    void setStart(const QDateTime& start) { setValue("start", start); }
     39    void setDuration(int duration) { setValue("duration", duration); }
     40    void setActivityId(int activityId) { setValue("xid_activity", activityId); }
     41    void setTypeId(int typeId) { setValue("type", typeId); }
     42    void setLanguageId(int languageId) { setValue("language", languageId); }
     43
     44friend class EventTest;
    5645};
    5746
Note: See TracChangeset for help on using the changeset viewer.