diff --git a/src/core/IndexerTrack.cpp b/src/core/IndexerTrack.cpp index 881ea7789..3dc8510f5 100644 --- a/src/core/IndexerTrack.cpp +++ b/src/core/IndexerTrack.cpp @@ -55,6 +55,7 @@ using namespace musik::core; IndexerTrack::IndexerTrack(DBINT id) :meta(NULL) ,id(id) + ,tempSortOrder(0) { } @@ -206,7 +207,7 @@ bool IndexerTrack::Save(db::Connection &dbConnection,utfstring libraryDirectory, ////////////////////////////////////////////////////////////////////////////// // 1. Start by inserting as many tags as possible into the tracks-table { - db::CachedStatement stmt("INSERT OR REPLACE INTO tracks (id,track,bpm,duration,filesize,year,folder_id,title,filename,filetime) VALUES (?,?,?,?,?,?,?,?,?,?)",dbConnection); + db::CachedStatement stmt("INSERT OR REPLACE INTO tracks (id,track,bpm,duration,filesize,year,folder_id,title,filename,filetime,sort_order1) VALUES (?,?,?,?,?,?,?,?,?,?,?)",dbConnection); // Bind all "static" tags (the once that are in the tracks tables) stmt.BindTextUTF(1,this->GetValue("track")); @@ -218,6 +219,7 @@ bool IndexerTrack::Save(db::Connection &dbConnection,utfstring libraryDirectory, stmt.BindTextUTF(7,this->GetValue("title")); stmt.BindTextUTF(8,this->GetValue("filename")); stmt.BindTextUTF(9,this->GetValue("filetime")); + stmt.BindInt(10,this->tempSortOrder); if(this->id!=0){ stmt.BindInt(0,this->id); @@ -551,7 +553,7 @@ bool IndexerTrack::GetTrackMetadata(db::Connection &db){ db::Statement genres("SELECT g.name FROM genres g,track_genres tg WHERE tg.genre_id=g.id AND tg.track_id=? ORDER BY tg.id",db); db::Statement artists("SELECT ar.name FROM artists ar,track_artists ta WHERE ta.artist_id=ar.id AND ta.track_id=? ORDER BY ta.id",db); db::Statement allMetadata("SELECT mv.content,mk.name FROM meta_values mv,meta_keys mk,track_meta tm WHERE tm.track_id=? AND tm.meta_value_id=mv.id AND mv.meta_key_id=mk.id ORDER BY tm.id",db); - db::Statement track("SELECT t.track,t.bpm,t.duration,t.filesize,t.year,t.title,t.filename,t.thumbnail_id,p.path||f.relative_path||'/'||t.filename,al.name,t.filetime FROM tracks t,folders f,paths p,albums al WHERE t.id=? AND t.folder_id=f.id AND f.path_id=p.id AND t.album_id=al.id",db); + db::Statement track("SELECT t.track,t.bpm,t.duration,t.filesize,t.year,t.title,t.filename,t.thumbnail_id,p.path||f.relative_path||'/'||t.filename,al.name,t.filetime,t.sort_order1 FROM tracks t,folders f,paths p,albums al WHERE t.id=? AND t.folder_id=f.id AND f.path_id=p.id AND t.album_id=al.id",db); track.BindInt(0,this->id); if(track.Step()==db::Row){ @@ -566,6 +568,7 @@ bool IndexerTrack::GetTrackMetadata(db::Connection &db){ this->SetValue("path",track.ColumnTextUTF(8)); this->SetValue("album",track.ColumnTextUTF(9)); this->SetValue("filetime",track.ColumnTextUTF(10)); + this->tempSortOrder = track.ColumnInt(11); // genres genres.BindInt(0,this->id); diff --git a/src/core/IndexerTrack.h b/src/core/IndexerTrack.h index 1922965ad..32e96c1ef 100644 --- a/src/core/IndexerTrack.h +++ b/src/core/IndexerTrack.h @@ -78,6 +78,7 @@ class IndexerTrack : public Track { private: // The variables DBINT id; + DBINT tempSortOrder; private: class MetaData{ public: