Make Channel::save_user_flags const, remove extra Video ctor calls
This commit is contained in:
parent
02519840a6
commit
bca774ea2e
4
yt.cpp
4
yt.cpp
|
@ -346,7 +346,7 @@ bool Channel::is_valid() const
|
||||||
return !id.empty() && !name.empty();
|
return !id.empty() && !name.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Channel::save_user_flags(sqlite3 *db)
|
void Channel::save_user_flags(sqlite3 *db) const
|
||||||
{
|
{
|
||||||
sqlite3_stmt *query;
|
sqlite3_stmt *query;
|
||||||
SC(sqlite3_prepare_v2(db, "UPDATE channels SET user_flags = ?2 WHERE channelID = ?1;", -1, &query, nullptr));
|
SC(sqlite3_prepare_v2(db, "UPDATE channels SET user_flags = ?2 WHERE channelID = ?1;", -1, &query, nullptr));
|
||||||
|
@ -388,7 +388,6 @@ std::vector<Video> Video::get_all_for_channel(const std::string &channel_id)
|
||||||
|
|
||||||
while(sqlite3_step(query) == SQLITE_ROW) {
|
while(sqlite3_step(query) == SQLITE_ROW) {
|
||||||
videos.emplace_back(query);
|
videos.emplace_back(query);
|
||||||
Video video(query);
|
|
||||||
}
|
}
|
||||||
SC(sqlite3_finalize(query));
|
SC(sqlite3_finalize(query));
|
||||||
|
|
||||||
|
@ -412,7 +411,6 @@ std::vector<Video> Video::get_all_with_filter(const ChannelFilter &filter)
|
||||||
|
|
||||||
while(sqlite3_step(query) == SQLITE_ROW) {
|
while(sqlite3_step(query) == SQLITE_ROW) {
|
||||||
videos.emplace_back(query);
|
videos.emplace_back(query);
|
||||||
Video video(query);
|
|
||||||
}
|
}
|
||||||
SC(sqlite3_finalize(query));
|
SC(sqlite3_finalize(query));
|
||||||
|
|
||||||
|
|
2
yt.h
2
yt.h
|
@ -77,7 +77,7 @@ public:
|
||||||
void load_info(sqlite3 *db);
|
void load_info(sqlite3 *db);
|
||||||
bool is_valid() const;
|
bool is_valid() const;
|
||||||
|
|
||||||
void save_user_flags(sqlite3 *db);
|
void save_user_flags(sqlite3 *db) const;
|
||||||
|
|
||||||
unsigned int unwatched;
|
unsigned int unwatched;
|
||||||
size_t tui_name_width;
|
size_t tui_name_width;
|
||||||
|
|
Loading…
Reference in New Issue