source: src/model/event.cpp @ 20a6010

qt5
Last change on this file since 20a6010 was 20a6010, checked in by komarma <komarma@…>, 13 years ago

Adding database loading and data conversion to orm module

  • Property mode set to 100644
File size: 725 bytes
Line 
1#include "event.h"
2
3QSqlRecord const Event::sColumns = Event::toRecord(QList<QSqlField>()
4    << QSqlField("id", QVariant::Int)
5    << QSqlField("xid_conference", QVariant::Int)
6    << QSqlField("start", QVariant::DateTime)
7    << QSqlField("duration", QVariant::Int)
8    << QSqlField("xid_activity", QVariant::Int)
9    << QSqlField("type", QVariant::String)
10    << QSqlField("language", QVariant::String));
11
12QString const Event::sTableName = QString("event");
13
14Event Event::getById(int id, int conferenceId)
15{
16    QString query = selectQuery() + "WHERE id = :id AND xid_conference = :conf";
17
18    QSqlQuery q;
19    q.prepare(query);
20    q.bindValue(":id", id);
21    q.bindValue(":conf", conferenceId);
22    return loadOne(q);
23}
Note: See TracBrowser for help on using the repository browser.