Changeset c790268 for src/mvc/event.cpp
- Timestamp:
- 01/17/10 17:22:03 (13 years ago)
- Branches:
- master, qt5
- Children:
- 6f39595
- Parents:
- 680a4da
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mvc/event.cpp
r680a4da rc790268 1 1 #include "event.h" 2 2 3 // 'event' record is splitted into two separate tables 'event' and 'virtual_event' 4 // for the FTS (Full-Text-Search) support and so, it is necessary to provide/use 5 // two table names + corresponding parameters/methods, see bellow 6 QString const Event::sTable1Name = QString("event"); 7 QString const Event::sTable2Name = QString("virtual_event"); 8 int const Event::sTable1ColCount = 8; // see 'toRecord()' for more details 9 int const Event::sTable2ColCount = 5; // see 'toRecord()' for more details 10 3 11 QSqlRecord const Event::sColumns = Event::toRecord(QList<QSqlField>() 12 /* 'columns from Table 1 */ 4 13 << QSqlField("id", QVariant::Int) 5 14 << QSqlField("xid_conference", QVariant::Int) … … 9 18 << QSqlField("type", QVariant::String) 10 19 << QSqlField("language", QVariant::String) 11 << QSqlField("favourite", QVariant::Bool)); 20 << QSqlField("favourite", QVariant::Bool) 21 /* 'columns' from Table2 */ 22 << QSqlField("tag", QVariant::String) 23 << QSqlField("title", QVariant::String) 24 << QSqlField("subtitle", QVariant::String) 25 << QSqlField("abstract", QVariant::String) 26 << QSqlField("description", QVariant::String)); 12 27 13 QString const Event::sTableName = QString("event");14 28 15 29 Event Event::getById(int id, int conferenceId) 16 30 { 17 31 QSqlQuery query; 18 query.prepare(selectQuery () + "WHERE id = :id ANDxid_conference = :conf");32 query.prepare(selectQueryJoin2T("id") + "WHERE event.id = :id AND event.xid_conference = :conf"); 19 33 query.bindValue(":id", id); 20 34 query.bindValue(":conf", conferenceId); 35 21 36 return loadOne(query); 22 37 } … … 25 40 { 26 41 QSqlQuery query; 27 query.prepare(selectQuery () + "WHERE xid_conference = :conf AND start >= :start AND start < :end ORDER BYstart");42 query.prepare(selectQueryJoin2T("id") + "WHERE event.xid_conference = :conf AND event.start >= :start AND event.start < :end ORDER BY event.start"); 28 43 query.bindValue(":conf", conferenceId); 29 44 query.bindValue(":start", convertToDb(date, QVariant::DateTime));
Note: See TracChangeset
for help on using the changeset viewer.