Add limit and since param
This commit is contained in:
parent
b6e73fa76d
commit
228e7b58dd
1 changed files with 3 additions and 1 deletions
|
|
@ -12,6 +12,8 @@ SQLITE_LOCATION = Config.get("Storage", "sqlite_location")
|
|||
class Data(Resource):
|
||||
def get(self):
|
||||
format = request.args['format']
|
||||
limit = request.args.get('limit', 20)
|
||||
since = request.args.get('since', 0)
|
||||
|
||||
conn = sqlite3.connect(SQLITE_LOCATION, timeout=60.0)
|
||||
cursor = conn.cursor()
|
||||
|
|
@ -24,7 +26,7 @@ class Data(Resource):
|
|||
col_names.append(col_data[i][1])
|
||||
|
||||
# Get data from database
|
||||
cursor.execute("SELECT * FROM Events ORDER BY UTCUnixTime DESC, SubSeconds DESC;")
|
||||
cursor.execute("SELECT * FROM Events WHERE UTCUnixTime >= %d ORDER BY UTCUnixTime DESC, SubSeconds DESC LIMIT %d;" % (since, limit))
|
||||
data = cursor.fetchall()
|
||||
conn.close()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue