Make sure QSqlQuery::exec() was successful
This commit is contained in:
parent
3bb0ee916d
commit
a4ebd91e8d
@ -787,10 +787,9 @@ Song CollectionBackend::GetSongByUrl(const QUrl &url, const qint64 beginning) {
|
|||||||
q.bindValue(":url3", url.toString(QUrl::FullyEncoded));
|
q.bindValue(":url3", url.toString(QUrl::FullyEncoded));
|
||||||
q.bindValue(":url4", url.toEncoded());
|
q.bindValue(":url4", url.toEncoded());
|
||||||
q.bindValue(":beginning", beginning);
|
q.bindValue(":beginning", beginning);
|
||||||
q.exec();
|
|
||||||
|
|
||||||
Song song(source_);
|
Song song(source_);
|
||||||
if (q.next()) {
|
if (q.exec() && q.next()) {
|
||||||
song.InitFromQuery(q, true);
|
song.InitFromQuery(q, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,13 +809,14 @@ SongList CollectionBackend::GetSongsByUrl(const QUrl &url) {
|
|||||||
q.bindValue(":url2", url.toString());
|
q.bindValue(":url2", url.toString());
|
||||||
q.bindValue(":url3", url.toString(QUrl::FullyEncoded));
|
q.bindValue(":url3", url.toString(QUrl::FullyEncoded));
|
||||||
q.bindValue(":url4", url.toEncoded());
|
q.bindValue(":url4", url.toEncoded());
|
||||||
q.exec();
|
|
||||||
|
|
||||||
SongList songs;
|
SongList songs;
|
||||||
while (q.next()) {
|
if (q.exec()) {
|
||||||
Song song(source_);
|
while (q.next()) {
|
||||||
song.InitFromQuery(q, true);
|
Song song(source_);
|
||||||
songs << song;
|
song.InitFromQuery(q, true);
|
||||||
|
songs << song;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return songs;
|
return songs;
|
||||||
@ -977,14 +977,15 @@ void CollectionBackend::UpdateCompilations(QSqlQuery &find_song, QSqlQuery &upda
|
|||||||
find_song.bindValue(":url2", url.toString());
|
find_song.bindValue(":url2", url.toString());
|
||||||
find_song.bindValue(":url3", url.toString(QUrl::FullyEncoded));
|
find_song.bindValue(":url3", url.toString(QUrl::FullyEncoded));
|
||||||
find_song.bindValue(":url4", url.toEncoded());
|
find_song.bindValue(":url4", url.toEncoded());
|
||||||
find_song.exec();
|
|
||||||
|
|
||||||
while (find_song.next()) {
|
if (find_song.exec()) {
|
||||||
Song song(source_);
|
while (find_song.next()) {
|
||||||
song.InitFromQuery(find_song, true);
|
Song song(source_);
|
||||||
deleted_songs << song;
|
song.InitFromQuery(find_song, true);
|
||||||
song.set_compilation_detected(compilation_detected);
|
deleted_songs << song;
|
||||||
added_songs << song;
|
song.set_compilation_detected(compilation_detected);
|
||||||
|
added_songs << song;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the song
|
// Update the song
|
||||||
|
Loading…
x
Reference in New Issue
Block a user