I'm wondering why I need to use a SDB.Database.Commit in the following code - If I don't then adding a track to a playlist causes the script to hang.
The only sql being done is a SDB.Database.QuerySongs and the wiki mentions that commit should only be needed if SDB.Database.BeginTransaction is used.
Code sample below:
Code: Select all
Set list = SDB.Database.QuerySongs("Artist = '" & CorrectSt(ArtistName) & "' AND SongTitle = '" & CorrectSt(TrackTitle) & "'")
SDB.Database.Commit
If list.EOF Then
Not_Added = Not_Added & VbCrLf & TrackTitle & " - " & ArtistName
End If
Plays = -1
Num_Dupes = 0
Do While Not list.EOF
Num_Dupes = Num_Dupes + 1
If list.item.Playcounter > Plays Then
Set Add_me = list.item
Plays = list.item.Playcounter
SDB.ProcessMessages
End If
list.Next
SDB.ProcessMessages
Loop
SDB.ProcessMessages
If Plays >= 0 Then
Playlist.AddTrack(Add_me)
logme "--Was added"
Else
logme "--Was not found in database"
End If