Use db_transaction helper class instead of using sqlite3_exec directly
This commit is contained in:
parent
215de112c7
commit
e47089325d
9
main.cpp
9
main.cpp
|
@ -262,11 +262,12 @@ void handle_watch_video(Video &video, bool mark_only) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_mark_all_videos_watched(Channel &channel) {
|
void handle_mark_all_videos_watched(Channel &channel) {
|
||||||
sqlite3_exec(db, "BEGIN TRANSACTION;", nullptr, nullptr, nullptr);
|
{
|
||||||
for(Video &video: videos[channel.id]) {
|
db_transaction transaction;
|
||||||
video.set_flag(db, kWatched);
|
for(Video &video: videos[channel.id]) {
|
||||||
|
video.set_flag(db, kWatched);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sqlite3_exec(db, "COMMIT TRANSACTION;", nullptr, nullptr, nullptr);
|
|
||||||
channel.load_info(db);
|
channel.load_info(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
yt.cpp
4
yt.cpp
|
@ -158,7 +158,7 @@ void Channel::fetch_new_videos(sqlite3 *db, progress_info *info, std::optional<s
|
||||||
{"key", yt_config.api_key},
|
{"key", yt_config.api_key},
|
||||||
};
|
};
|
||||||
|
|
||||||
sqlite3_exec(db, "BEGIN TRANSACTION;", nullptr, nullptr, nullptr);
|
db_transaction transaction;
|
||||||
|
|
||||||
int processed = 0;
|
int processed = 0;
|
||||||
bool abort = false;
|
bool abort = false;
|
||||||
|
@ -210,8 +210,6 @@ void Channel::fetch_new_videos(sqlite3 *db, progress_info *info, std::optional<s
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3_exec(db, "COMMIT TRANSACTION;", nullptr, nullptr, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Channel::load_info(sqlite3 *db)
|
void Channel::load_info(sqlite3 *db)
|
||||||
|
|
Loading…
Reference in New Issue