diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-01-05 03:52:20 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-01-05 03:52:20 -0500 |
commit | 40106ddeb11a755864e446920b74739f1ec21c57 (patch) | |
tree | accbb08e769727e623fb53223d00e71b1c57482e /src/discord/store.cpp | |
parent | 8695562cb4b34c70d4d6b607042988de7b6e244d (diff) | |
download | abaddon-portaudio-40106ddeb11a755864e446920b74739f1ec21c57.tar.gz abaddon-portaudio-40106ddeb11a755864e446920b74739f1ec21c57.zip |
handle mutable categories
Diffstat (limited to 'src/discord/store.cpp')
-rw-r--r-- | src/discord/store.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/discord/store.cpp b/src/discord/store.cpp index 5e4e3b3..aa97178 100644 --- a/src/discord/store.cpp +++ b/src/discord/store.cpp @@ -571,6 +571,21 @@ std::vector<ChannelData> Store::GetActiveThreads(Snowflake channel_id) const { return ret; } +std::vector<Snowflake> Store::GetChannelIDsWithParentID(Snowflake channel_id) const { + auto &s = m_stmt_get_chan_ids_parent; + + s->Bind(1, channel_id); + + std::vector<Snowflake> ret; + while (s->FetchOne()) { + Snowflake x; + s->Get(0, x); + ret.push_back(x); + } + + return ret; +} + void Store::AddReaction(const MessageReactionAddObject &data, bool byself) { auto &s = m_stmt_add_reaction; @@ -2120,6 +2135,14 @@ bool Store::CreateStatements() { return false; } + m_stmt_get_chan_ids_parent = std::make_unique<Statement>(m_db, R"( + SELECT id FROM channels WHERE parent_id = ? + )"); + if (!m_stmt_get_chan_ids_parent->OK()) { + fprintf(stderr, "failed to prepare get channel ids for parent statement: %s\n", m_db.ErrStr()); + return false; + } + return true; } |