X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2FSQL%2FPostgreSQL%2Fselect_messagesNewestK_filtered.sql;fp=src%2Fcore%2FSQL%2FPostgreSQL%2Fselect_messagesNewestK_filtered.sql;h=cdb960c7e0a8088d2270c792602aeeaf9cfb2e16;hb=b9169a652a6854b3fa85aee8f833cb9e18a8d510;hp=0000000000000000000000000000000000000000;hpb=b8d7e647bca45cba82db5fa38c58f336aefe5768;p=quassel.git diff --git a/src/core/SQL/PostgreSQL/select_messagesNewestK_filtered.sql b/src/core/SQL/PostgreSQL/select_messagesNewestK_filtered.sql new file mode 100644 index 00000000..cdb960c7 --- /dev/null +++ b/src/core/SQL/PostgreSQL/select_messagesNewestK_filtered.sql @@ -0,0 +1,9 @@ +SELECT messageid, time, type, flags, sender, senderprefixes, realname, avatarurl, message +FROM backlog +JOIN sender ON backlog.senderid = sender.senderid +WHERE bufferid = :buffer + AND backlog.messageid <= (SELECT buffer.lastmsgid FROM buffer WHERE buffer.bufferid = :buffer) + AND backlog.type & :type != 0 + AND (:flags = 0 OR backlog.flags & :flags != 0) +ORDER BY messageid DESC +LIMIT :limit