View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011448 | MMW v4 | Framework: Scripts/Extensions | public | 2013-11-04 15:16 | 2013-11-04 15:16 |
Reporter | zvezdan | Assigned To | |||
Priority | none | Severity | feature | Reproducibility | N/A |
Status | new | Resolution | open | ||
Summary | 0011448: ISDBDatabase::CustomQuerySongs method needed | ||||
Description | With the existing QuerySongs we could get SDBSongIterator object by specifying a condition part of some SQL statement. However, sometimes it is desirable to get a list of files using full SQL statement, e.g. because it is composed from several tables, not only Songs. Something similar to that we already have with the SDBTracksWindow object which have two methods for those two approaches - with AddTracksFromQuery we could fill the filelist using a condition part of SQL statement, and with AddTracksFromCustomQuery we could fill the filelist using full SQL statement. Currently, to be able to get list of SongData objects using full SQL statement I need to use something like this: sFullQuery = "SELECT Songs.ID FROM Songs INNER JOIN Medias ON Songs.IDMedia = Medias.IDMedia WHERE some_thing" Set oDbIter = SDB.Database.OpenSQL(sFullQuery) Do While Not oDbIter.EOF sWherePart = "Songs.ID = " & oDbIter.ValueByIndex(0) If SDB.VersionHi < 3 Then sWherePart = "AND " & sWherePart Set oSongIter = SDB.Database.QuerySongs(sWherePart) If Not oSongIter.EOF Then oSongList.Add oSongIter.Item End If Set oSongIter = Nothing oDbIter.Next Loop Set oDbIter = Nothing However, with such code I have two iterators, one inside another, and I am afraid it could raise some errors because of the database locking. Another alternative is to use some temporary array for storing Songs.IDs inside of the first database iterator (oDbIter) and to use the second song iterator (oSongIter) outside of it, i.e. after Set oDbIter = Nothing, but all of that is too complicated for something that should be easier for scripters. | ||||
Tags | No tags attached. | ||||
Fixed in build | |||||