Comment 0 for bug 1937941

Revision history for this message
Adam Szmigin (smidge) wrote :

Affected version(s):
---

Latest source build from main (commit bee21d8912c839d647cebf15a15ab006b2980995)

Steps to reproduce:
---

I have been unable to reproduce this since the initial occurrence, but these are the steps I took:

1. Ensure that Mixxx is set up with multiple music directories as part of the library.
2. Open Mixxx, navigate to Preferences.
3. Remove one of the music directories
4. Choose option to delete track metadata.

Expected behaviour:
---

Directory is deleted without fanfare, and without assertions failing.

Actual behaviour:
---

A critical debug assertion is raised:

```
critical [Main] FwdSqlQuery - Failed to prepare "UPDATE library SET timesplayed=q.timesplayed,last_played_at=q.last_played_at FROM(SELECT PlaylistTracks.track_id as id,COUNT(PlaylistTracks.track_id) as timesplayed,MAX(PlaylistTracks.pl_datetime_added) as last_played_at FROM PlaylistTracks JOIN Playlists ON PlaylistTracks.playlist_id=Playlists.id WHERE Playlists.hidden=2 GROUP BY PlaylistTracks.track_id) q WHERE library.id=q.id AND library.id IN (3391)" : QSqlError("1", "Unable to execute statement", "near \"FROM\": syntax error")
critical [Main] DEBUG ASSERT: "!query.hasError()" in function bool TrackDAO::updatePlayCounterFromPlayedHistory(const QSet<TrackId> &) const at /home/smidge/Development/Audio/Mixxx/mixxx-github/src/library/dao/trackdao.cpp:2248
```

The SQL, when formatted better, looks like this:

```sql
UPDATE library
SET timesplayed=q.timesplayed,
    last_played_at=q.last_played_at
FROM (
    SELECT PlaylistTracks.track_id as id,
           COUNT(PlaylistTracks.track_id) as timesplayed,
           MAX(PlaylistTracks.pl_datetime_added) as last_played_at
    FROM PlaylistTracks
    JOIN Playlists ON PlaylistTracks.playlist_id=Playlists.id
    WHERE Playlists.hidden=2
    GROUP BY PlaylistTracks.track_id) q
WHERE library.id=q.id
AND library.id IN (3391)
```