-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
last played: this change breaks the PR. Why doesn't bindValue work??
- Loading branch information
Showing
1 changed file
with
10 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,18 +24,17 @@ LastPlayedCache::LastPlayedCache(TrackCollection* trackCollection) | |
void LastPlayedCache::initTableView() { | ||
// XXX: why isn't value binding working??? | ||
QSqlQuery lastPlayedQuery(m_pTrackCollection->database()); | ||
lastPlayedQuery.prepare(QStringLiteral( | ||
"CREATE TEMPORARY VIEW IF NOT EXISTS %1 AS " | ||
lastPlayedQuery.prepare( | ||
"CREATE TEMPORARY VIEW IF NOT EXISTS last_played AS " | ||
"SELECT " | ||
" PlaylistTracks.track_id, " | ||
" MAX(PlaylistTracks.pl_datetime_added) as datetime_played " | ||
"FROM PlaylistTracks " | ||
"JOIN Playlists ON PlaylistTracks.playlist_id == Playlists.id " | ||
"WHERE Playlists.hidden = %2 " | ||
"GROUP BY PlaylistTracks.track_id") | ||
.arg(LASTPLAYEDTABLE_NAME, | ||
QString::number(PlaylistDAO:: | ||
PLHT_SET_LOG))); | ||
"WHERE Playlists.hidden = :setlogid " | ||
"GROUP BY PlaylistTracks.track_id"); | ||
// .arg(LASTPLAYEDTABLE_NAME)); | ||
lastPlayedQuery.bindValue(":setlogid", PlaylistDAO::PLHT_SET_LOG); | ||
if (!lastPlayedQuery.exec()) { | ||
LOG_FAILED_QUERY(lastPlayedQuery); | ||
} | ||
|
@@ -62,10 +61,10 @@ QDateTime LastPlayedCache::fetchLastPlayedTime(const QSqlDatabase& db, TrackPoin | |
" FROM " | ||
" last_played " | ||
" WHERE " | ||
" track_id = %1 ") | ||
.arg(pTrack->getId().toString()); | ||
updateQuery.prepare(queryString); | ||
// updateQuery.bindValue(":trackId", trackId.toVariant()); | ||
" track_id = :trackid "); | ||
// .arg(pTrack->getId().toString()); | ||
qDebug() << "yesSss????????????? " << updateQuery.prepare(queryString); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ywwg
Author
Member
|
||
updateQuery.bindValue(":trackid", pTrack->getId().toVariant(), QSql::Out); | ||
if (!updateQuery.exec()) { | ||
LOG_FAILED_QUERY(updateQuery); | ||
} | ||
|
Can we get some more descriptive qDebug text here please?