diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-01-08 20:11:52 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-01-08 20:11:52 -0500 |
commit | f31d431517b27a88a95f6972de8fcf3206df1da1 (patch) | |
tree | 772ee0241f8f79c510aa158e0d5f1a04302214c9 /src/discord/store.cpp | |
parent | f19dcc01145edd2e69a8cccbc59258b6b73bd704 (diff) | |
parent | 604f2ffe3dc8978aebd6aa819b73374aa32d2f0e (diff) | |
download | abaddon-portaudio-f31d431517b27a88a95f6972de8fcf3206df1da1.tar.gz abaddon-portaudio-f31d431517b27a88a95f6972de8fcf3206df1da1.zip |
Merge branch 'unread' into msys
Diffstat (limited to 'src/discord/store.cpp')
-rw-r--r-- | src/discord/store.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/discord/store.cpp b/src/discord/store.cpp index 5e4e3b3..e182c70 100644 --- a/src/discord/store.cpp +++ b/src/discord/store.cpp @@ -571,6 +571,23 @@ 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); + } + + s->Reset(); + + return ret; +} + void Store::AddReaction(const MessageReactionAddObject &data, bool byself) { auto &s = m_stmt_add_reaction; @@ -2120,6 +2137,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; } |