Changeset 7620de0 for src/mvc/event.cpp
- Timestamp:
- 01/25/10 13:52:01 (13 years ago)
- Branches:
- master, qt5
- Children:
- c7b58d4
- Parents:
- 7b70507
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mvc/event.cpp
r7b70507 r7620de0 1 1 #include "event.h" 2 #include "room.h" 2 3 3 4 QString const Event::sTableName = QString("event"); … … 40 41 } 41 42 43 QList<Event> Event::getByDateAndRoom(const QDate& date, int conferenceId) 44 { 45 QSqlQuery query; 46 QString aliasEvent("E"); 47 QString aliasEventRoom("R"); 48 query.prepare(QString("SELECT %1 FROM %2 %3, %4 %5 WHERE %3.xid_conference = :conf AND %3.start >= :start AND %3.start < :end AND %3.id = R.xid_event ORDER BY %5.xid_room, %3.start").arg( 49 columnsForSelect(aliasEvent), Event::sTableName, aliasEvent, "EVENT_ROOM", aliasEventRoom)); 50 query.bindValue(":conf", conferenceId); 51 query.bindValue(":start", convertToDb(date, QVariant::DateTime)); 52 query.bindValue(":end", convertToDb(date.addDays(1), QVariant::DateTime)); 53 54 return load(query); 55 } 56 42 57 QList<Event> Event::nowEvents(int conferenceId, QString orderBy) 43 58 { … … 65 80 } 66 81 67 QList<Event> Event::getByTrack(int trackId)68 {69 QSqlQuery query;70 query.prepare(selectQuery() + QString("WHERE xid_track = :trackId ORDER BY start"));71 query.bindValue(":trackId", trackId);72 73 return load(query);74 }75 76 82 QString Event::room() const 77 83 { … … 87 93 else 88 94 return QString("not-available"); 95 } 96 97 int Event::roomId() const 98 { 99 QSqlQuery query; 100 query.prepare("SELECT xid_room FROM event_room WHERE xid_event = :id"); 101 query.bindValue(":id", id()); 102 if (!query.isActive()) 103 if (!query.exec()) 104 throw OrmSqlException(query.lastError().text()); 105 if (!query.next()) 106 throw OrmNoObjectException(); 107 return query.record().value("xid_room").toInt(); 89 108 } 90 109
Note: See TracChangeset
for help on using the changeset viewer.