To return to this point...
No, SDB.MainTracksWindow.AddTracksFromQuery() is the fastest way to add tracks to the main window, as long as you don't have slow SQL's.
I have about 5000 songs in my database so far. As before, I need to add tracks by ID to the TracksWindow. Using AddTracksFromQuery() is around 10 times slower than a way I have found which is rather kludgy (so I would prefer replaced) but is lightning quick - this is basically what happens:
When Mediamonkey boots up, I copy each SongData object for all tracks to an Objects array thusly:
Code: Select all
Set it = SDB.Database.QuerySongs("id > 0")
Do While Not it.EOF
SDB.Objects(it.Item.ID) = it.Item ' Copy the SongData object to each Object in the array
it.Next
Loop
I then use later: mytrackswindow.AddTrack( SDB.Objects( id(n)) ) - where "id" is an array containing thousands of ID numbers. Doing it this way is much faster than AddTracksFromQuery() alone. Even if I use ID IN(" & MyString & ")" (which I think you mentioned a while back), my above kludgy method is almost twice as fast (and also, using ID IN.... won't keep the order of the thousands of ID numbers (separated by commas) in MyString - though perhaps there's a way around that?).
This is why my reasoning for allowing the AddTrackById method for SDBTracksWindow would be a great boon. Thousands of ID numbers could be added directly without having to scan the database for each and every ID as with AddTracksFromQuery(). Am I overlooking something?
To return to this point...
[quote]No, SDB.MainTracksWindow.AddTracksFromQuery() is the fastest way to add tracks to the main window, as long as you don't have slow SQL's.[/quote]
I have about 5000 songs in my database so far. As before, I need to add tracks by ID to the TracksWindow. Using AddTracksFromQuery() is around 10 times slower than a way I have found which is rather kludgy (so I would prefer replaced) but is lightning quick - this is basically what happens:
When Mediamonkey boots up, I copy each SongData object for all tracks to an Objects array thusly:
[code]
Set it = SDB.Database.QuerySongs("id > 0")
Do While Not it.EOF
SDB.Objects(it.Item.ID) = it.Item ' Copy the SongData object to each Object in the array
it.Next
Loop
[/code]
I then use later: mytrackswindow.AddTrack( SDB.Objects( id(n)) ) - where "id" is an array containing thousands of ID numbers. Doing it this way is much faster than AddTracksFromQuery() alone. Even if I use ID IN(" & MyString & ")" (which I think you mentioned a while back), my above kludgy method is almost twice as fast (and also, using ID IN.... won't keep the order of the thousands of ID numbers (separated by commas) in MyString - though perhaps there's a way around that?).
This is why my reasoning for allowing the AddTrackById method for SDBTracksWindow would be a great boon. Thousands of ID numbers could be added directly without having to scan the database for each and every ID as with AddTracksFromQuery(). Am I overlooking something?