зеркало из https://github.com/mozilla/gecko-dev.git
b=353759, new-graph webtools import script; patch from dmills@mozilla.com, r=vlad
This commit is contained in:
Родитель
6f6d86a660
Коммит
64f2c6054f
|
@ -47,6 +47,16 @@ if replace:
|
|||
db.execute("DELETE FROM dataset_values WHERE dataset_id = ?", (setid,))
|
||||
db.execute("DELETE FROM dataset_extra_data WHERE dataset_id = ?", (setid,))
|
||||
|
||||
cur = db.cursor()
|
||||
cur.execute("SELECT time FROM dataset_values WHERE dataset_id = ? ORDER BY time DESC LIMIT 1", (setid,))
|
||||
latest = cur.fetchone()
|
||||
if latest == None:
|
||||
latest = 0
|
||||
else:
|
||||
latest = latest[0]
|
||||
|
||||
db.commit() # release any locks
|
||||
|
||||
count = 0
|
||||
line = sys.stdin.readline()
|
||||
while line is not None:
|
||||
|
@ -63,9 +73,11 @@ while line is not None:
|
|||
|
||||
timeval = time.mktime(map(int, string.split(datestr, ":")) + [0, 0, 0])
|
||||
|
||||
db.execute("INSERT INTO dataset_values (dataset_id,time,value) VALUES (?,?,?)", (setid, timeval, val))
|
||||
db.execute("INSERT INTO dataset_extra_data (dataset_id,time,data) VALUES (?,?,?)", (setid, timeval, data))
|
||||
count = count + 1
|
||||
if timeval > latest:
|
||||
db.execute("INSERT INTO dataset_values (dataset_id,time,value) VALUES (?,?,?)", (setid, timeval, val))
|
||||
db.execute("INSERT INTO dataset_extra_data (dataset_id,time,data) VALUES (?,?,?)", (setid, timeval, data))
|
||||
count = count + 1
|
||||
|
||||
line = sys.stdin.readline()
|
||||
|
||||
db.commit()
|
||||
|
|
Загрузка…
Ссылка в новой задаче