Changeset 005e2b7 for src/mvc/track.cpp


Ignore:
Timestamp:
01/22/10 09:30:11 (12 years ago)
Author:
korrco <korrco@…>
Branches:
master, qt5
Children:
8200b03
Parents:
ab6110b
Message:

caching removed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/track.cpp

    rab6110b r005e2b7  
    1717    << QSqlField(NAME, QVariant::String));
    1818
    19 QMap<int, Track> Track::mIdToTrack;
     19//QMap<int, Track> Track::mIdToTrack;
    2020
    2121class TrackInsertException : OrmSqlException
     
    5757}
    5858
    59 void Track::updateTrackMap()
     59Track Track::retrieve(int id)
    6060{
    61     mIdToTrack.clear();
    62     QList<Track> trackList = Track::getAll();
    63     Track track;
    64     for (int id = 0; id < trackList.count(); ++id) {
    65         track = trackList.at(id);
    66         mIdToTrack.insert(track.id(), track);
    67     }
     61    QSqlQuery query;
     62    query.prepare(selectQuery()
     63            + QString("WHERE %1.id = :id").arg(sTableName));
     64    query.bindValue(":id", id);
     65    return loadOne(query);
    6866}
    6967
    70 QString Track::getTrackName(int id)
     68QString Track::retrieveTrackName(int id)
    7169{
    72     QString name = mIdToTrack.value(id).name();
    73     if (name == "") {
    74         qDebug() << QString("Error: undefined activity name for id %1").arg(id);
    75     }
    76     return name;
     70    Track track = retrieve(id);
     71    return track.name();
    7772}
Note: See TracChangeset for help on using the changeset viewer.