Fixed and tweaked getupdate
This commit is contained in:
parent
fc3c0f44c5
commit
e3188c7331
|
@ -21,11 +21,12 @@ def handle(request):
|
||||||
def callback(method, data):
|
def callback(method, data):
|
||||||
cur = glob.sql.cursor()
|
cur = glob.sql.cursor()
|
||||||
|
|
||||||
if method is "file_hash":
|
query = "SELECT a.* FROM updates a INNER JOIN ( SELECT MAX(file_version) file_version, filename FROM updates WHERE {} < {} GROUP BY filename) b ON a.file_version = b.file_version"
|
||||||
cur.execute("SELECT * FROM updates WHERE file_hash = '{}'".format(
|
if method is "timestamp":
|
||||||
data
|
query += " ORDER BY a.timestamp DESC"
|
||||||
))
|
elif method is "file_hash":
|
||||||
else:
|
query = "SELECT * FROM updates WHERE {} = '{}'"
|
||||||
|
|
||||||
cur.execute("SELECT a.* FROM updates a INNER JOIN ( SELECT MAX(file_version) file_version, filename FROM updates WHERE {} < {} GROUP BY filename) b ON a.file_version = b.file_version;".format(
|
cur.execute("SELECT a.* FROM updates a INNER JOIN ( SELECT MAX(file_version) file_version, filename FROM updates WHERE {} < {} GROUP BY filename) b ON a.file_version = b.file_version;".format(
|
||||||
method,
|
method,
|
||||||
data
|
data
|
||||||
|
|
Loading…
Reference in New Issue
Block a user