Skip to content

Commit

Permalink
Merge pull request Bitmessage#62 from navjotcis/newwork
Browse files Browse the repository at this point in the history
worked on optimizing sql query for all screens
  • Loading branch information
navjotcis committed Dec 4, 2019
2 parents b5b69f6 + 3fc7414 commit e13aa5a
Show file tree
Hide file tree
Showing 2 changed files with 203 additions and 160 deletions.
8 changes: 5 additions & 3 deletions src/bitmessagekivy/kivy_helper_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from helper_sql import sqlQuery


def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, what=None, unreadOnly=False):
def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, what=None, unreadOnly=False, start_indx=0, end_indx=20):
"""Method helping for searching mails"""
# pylint: disable=too-many-arguments, too-many-branches
if what is not None and what != "":
Expand Down Expand Up @@ -59,7 +59,9 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w
if sqlStatementParts:
sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts)
if folder == "sent" or folder == "draft":
sqlStatementBase += " ORDER BY lastactiontime DESC"
sqlStatementBase += " ORDER BY lastactiontime DESC limit {0}, {1}".format(start_indx, end_indx)
elif folder == "inbox":
sqlStatementBase += " ORDER BY received DESC"
sqlStatementBase += " ORDER BY received DESC limit {0}, {1}".format(start_indx, end_indx)
elif folder == "addressbook":
sqlStatementBase += " limit {0}, {1}".format(start_indx, end_indx)
return sqlQuery(sqlStatementBase, sqlArguments)
Loading

0 comments on commit e13aa5a

Please sign in to comment.