diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-11-13 23:09:28 +0100 |
---|---|---|
committer | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2020-11-13 23:12:19 +0100 |
commit | 2299b25c0a4255a44306fe176d79bf2587545720 (patch) | |
tree | 10aa7110a454ff8a91d6b26cd45f0e1d6074f6b2 /src/library/dao | |
parent | 3a9048073bf045c40ae015d61634bf6248540ce2 (diff) |
Fix -Wclazy-qstring-arg warnings
Avoids unnecessary memory allocations by using the multi-arg overload. See
https://github.com/KDE/clazy/blob/master/docs/checks/README-qstring-arg.md
for details.
Diffstat (limited to 'src/library/dao')
-rw-r--r-- | src/library/dao/playlistdao.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/library/dao/playlistdao.cpp b/src/library/dao/playlistdao.cpp index 00e22bb4c5..b4226ba9a8 100644 --- a/src/library/dao/playlistdao.cpp +++ b/src/library/dao/playlistdao.cpp @@ -677,13 +677,14 @@ bool PlaylistDAO::copyPlaylistTracks(const int sourcePlaylistID, const int targe // INSERT INTO PlaylistTracks (playlist_id, track_id, position, pl_datetime_added) SELECT :target_plid, track_id, position + :position_offset, pl_datetime_added FROM PlaylistTracks WHERE playlist_id = :source_plid; QSqlQuery query(m_database); query.prepare(QString("INSERT INTO " PLAYLIST_TRACKS_TABLE - " (%1, %2, %3, %4) SELECT :target_plid, %2, " - "%3 + :position_offset, %4 FROM " PLAYLIST_TRACKS_TABLE - " WHERE %1 = :source_plid") - .arg(PLAYLISTTRACKSTABLE_PLAYLISTID) // %1 - .arg(PLAYLISTTRACKSTABLE_TRACKID) // %2 - .arg(PLAYLISTTRACKSTABLE_POSITION) // %3 - .arg(PLAYLISTTRACKSTABLE_DATETIMEADDED)); // %4 + " (%1, %2, %3, %4) SELECT :target_plid, %2, " + "%3 + :position_offset, %4 FROM " PLAYLIST_TRACKS_TABLE + " WHERE %1 = :source_plid") + .arg( + PLAYLISTTRACKSTABLE_PLAYLISTID, // %1 + PLAYLISTTRACKSTABLE_TRACKID, // %2 + PLAYLISTTRACKSTABLE_POSITION, // %3 + PLAYLISTTRACKSTABLE_DATETIMEADDED)); // %4 query.bindValue(":position_offset", positionOffset); query.bindValue(":source_plid", sourcePlaylistID); query.bindValue(":target_plid", targetPlaylistID); @@ -696,10 +697,11 @@ bool PlaylistDAO::copyPlaylistTracks(const int sourcePlaylistID, const int targe // Query each added track and its new position. // SELECT track_id, position FROM PlaylistTracks WHERE playlist_id = :target_plid AND position > :position_offset; query.prepare(QString("SELECT %2, %3 FROM " PLAYLIST_TRACKS_TABLE - " WHERE %1 = :target_plid AND %3 > :position_offset") - .arg(PLAYLISTTRACKSTABLE_PLAYLISTID) // %1 - .arg(PLAYLISTTRACKSTABLE_TRACKID) // %2 - .arg(PLAYLISTTRACKSTABLE_POSITION)); // %3 + " WHERE %1 = :target_plid AND %3 > :position_offset") + .arg( + PLAYLISTTRACKSTABLE_PLAYLISTID, // %1 + PLAYLISTTRACKSTABLE_TRACKID, // %2 + PLAYLISTTRACKSTABLE_POSITION)); // %3 query.bindValue(":target_plid", targetPlaylistID); query.bindValue(":position_offset", positionOffset); if (!query.exec()) { |