Changeset e662750 for src/mvc


Ignore:
Timestamp:
01/21/10 10:49:41 (13 years ago)
Author:
timkoma <timkoma@…>
Branches:
master, qt5
Children:
72cd3af
Parents:
842f5f9
Message:

first working version of the search

Location:
src/mvc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/event.cpp

    r842f5f9 re662750  
    114114}
    115115
     116QList<Event> Event::getSearchResultByDate(const QDate& date, int conferenceId, QString orderBy)
     117{
     118
     119    QString strQuery = QString("SELECT %1 FROM EVENT INNER JOIN VIRTUAL_EVENT USING (xid_conference, id) "
     120        "INNER JOIN SEARCH_EVENT USING (xid_conference, id) ").arg( columnsForSelectJoin2T() );
     121    strQuery += QString(
     122        "WHERE %1.xid_conference = :conf AND %1.start >= :start AND %1.start < :end ORDER BY %1.%2").arg(sTable1Name, orderBy);
     123    qDebug() << strQuery;
     124    QSqlQuery query;
     125    query.prepare( strQuery );
     126    query.bindValue(":conf", conferenceId);
     127    query.bindValue(":start", convertToDb(date, QVariant::DateTime));
     128    query.bindValue(":end", convertToDb(date.addDays(1), QVariant::DateTime));
     129
     130    return load(query);
     131}
     132
  • src/mvc/event.h

    r842f5f9 re662750  
    2828    static QList<Event> getByDate(const QDate & date, int conferenceId, QString orderBy);
    2929    static QList<Event> getFavByDate(const QDate & date, int conferenceId); // get Favourities by Date
     30    static QList<Event> getSearchResultByDate(const QDate& date, int conferenceId, QString orderBy);
    3031public:
    3132    // Table 1
  • src/mvc/eventmodel.cpp

    r842f5f9 re662750  
    183183}
    184184
     185void EventModel::loadSearchResultEvents(const QDate &aDate, int aConferenceId)
     186{
     187    clearModel();
     188    // check for existence of the conference in the DB
     189    if(Conference::getAll().count())
     190    {
     191        qDebug() << "Loading search result Data: [" << Conference::getById(aConferenceId).title() << "] " << aDate;
     192        mEvents = Event::getSearchResultByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start");
     193    }
     194    createTimeGroups();
     195}
     196
    185197void EventModel::loadEventsByTrack(const QDate &aDate, int aConferenceId)
    186198{
  • src/mvc/eventmodel.h

    r842f5f9 re662750  
    2020    void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB
    2121    void loadEventsByTrack(const QDate &aDate, int aConferenceId); // loads Events grouped by Track from the DB
     22    void loadSearchResultEvents(const QDate &aDate, int aConferenceId);
    2223    // a method to force 'EventModel' emit signal 'dataChanged()'
    2324    // a 'view', eg. 'TreeView' listens for this signal and redraws changed items(indexes)
Note: See TracChangeset for help on using the changeset viewer.