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.cpp

    r5a73d27 r20a6010  
    11#include "event.h"
    22
    3 QStringList const Event::sColNames = QStringList()
    4     << "id" << "xid_conference" << "start" << "duration" << "xid_activity" << "type" << "language";
     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));
    511
    612QString 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 TracChangeset for help on using the changeset viewer.