From c64e97f0d6c2639bad1b73e68bca1a1cb377b843 Mon Sep 17 00:00:00 2001 From: Ivanq Date: Thu, 26 Oct 2017 18:32:05 +0300 Subject: [PATCH 1/2] DbQuery: WHERE without AND is still WHERE --- src/Db/DbQuery.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Db/DbQuery.py b/src/Db/DbQuery.py index 10ce773b..a7730d5b 100644 --- a/src/Db/DbQuery.py +++ b/src/Db/DbQuery.py @@ -22,6 +22,8 @@ class DbQuery: def parseWheres(self, query_where): if " AND " in query_where: return query_where.split(" AND ") + elif query_where: + return [query_where] else: return [] From 818983831a840065401bb822ef81285c84639a9f Mon Sep 17 00:00:00 2001 From: Ivanq Date: Thu, 26 Oct 2017 18:34:53 +0300 Subject: [PATCH 2/2] Newsfeed: Add brackets around WHERE --- plugins/Newsfeed/NewsfeedPlugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Newsfeed/NewsfeedPlugin.py b/plugins/Newsfeed/NewsfeedPlugin.py index 6cd3a467..c73aad2b 100644 --- a/plugins/Newsfeed/NewsfeedPlugin.py +++ b/plugins/Newsfeed/NewsfeedPlugin.py @@ -105,7 +105,7 @@ class UiWebsocketPlugin(object): for name, query in feeds.iteritems(): try: db_query = DbQuery(query) - db_query.wheres.append("%s LIKE ? OR %s LIKE ?" % (db_query.fields["body"], db_query.fields["title"])) + db_query.wheres.append("(%s LIKE ? OR %s LIKE ?)" % (db_query.fields["body"], db_query.fields["title"])) db_query.parts["ORDER BY"] = "date_added DESC" db_query.parts["LIMIT"] = "30"