Bug 388658 - graph server should handle duplicate data better

p=anodelman r=morgamic


git-svn-id: svn://10.0.0.236/trunk@252133 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
anodelman%mozilla.com
2008-06-05 21:04:28 +00:00
parent a19fdcde5a
commit 59546479fe
2 changed files with 49 additions and 1 deletions

View File

@@ -74,7 +74,7 @@ if form.has_key("filename"):
line = line.rstrip("\n\r")
contents = line.split(',')
#clear any previous content in the fields variables - stops reuse of data over lines
for field in fields:
for field in fields:
globals()[field] = ''
if len(contents) < 7:
print "Incompatable file format"
@@ -127,6 +127,30 @@ if form.has_key("filename"):
else:
setid = res[0][0]
#determine if we've seen this set of data before
if (type == "discrete" and int(timeval) == 0):
cur = db.cursor()
cur.execute("SELECT dataset_id FROM dataset_values WHERE dataset_id = ? AND time = ?", (setid, timeval))
res = cur.fetchall()
cur.close
if len(res) <> 0:
print "found a matching discrete data set"
db.execute("DELETE FROM dataset_values WHERE dataset_id = ?", (setid,))
db.execute("DELETE FROM dataset_branchinfo WHERE dataset_id = ?", (setid,))
db.execute("DELETE FROM dataset_extra_data WHERE dataset_id = ?", (setid,))
db.execute("DELETE FROM annotations WHERE dataset_id = ?", (setid,))
elif (type == "continuous"):
cur = db.cursor()
cur.execute("SELECT dataset_id FROM dataset_values WHERE dataset_id = ? AND time = ?", (setid, timeval))
res = cur.fetchall()
cur.close
if len(res) <> 0:
print "found a matching continuous data point"
db.execute("DELETE FROM dataset_values WHERE dataset_id = ? AND time = ?", (setid, timeval))
db.execute("DELETE FROM dataset_branchinfo WHERE dataset_id = ? AND time = ?", (setid, timeval))
db.execute("DELETE FROM dataset_extra_data WHERE dataset_id = ? AND time = ?", (setid, timeval))
db.execute("DELETE FROM annotations WHERE dataset_id = ? AND time = ?", (setid, timeval))
db.execute("INSERT INTO dataset_values (dataset_id, time, value) VALUES (?,?,?)", (setid, timeval, value))
db.execute("INSERT INTO dataset_branchinfo (dataset_id, time, branchid) VALUES (?,?,?)", (setid, timeval, branchid))
if data and data != "":

View File

@@ -104,6 +104,30 @@ while setid == -1:
else:
setid = res[0][0]
#determine if we've seen this set of data before
if (type == "discrete" and int(timeval) == 0):
cur = db.cursor()
cur.execute("SELECT dataset_id FROM dataset_values WHERE dataset_id = ? AND time = ?", (setid, timeval))
res = cur.fetchall()
cur.close
if len(res) <> 0:
print "found a matching discrete data set"
db.execute("DELETE FROM dataset_values WHERE dataset_id = ?", (setid,))
db.execute("DELETE FROM dataset_branchinfo WHERE dataset_id = ?", (setid,))
db.execute("DELETE FROM dataset_extra_data WHERE dataset_id = ?", (setid,))
db.execute("DELETE FROM annotations WHERE dataset_id = ?", (setid,))
elif (type == "continuous"):
cur = db.cursor()
cur.execute("SELECT dataset_id FROM dataset_values WHERE dataset_id = ? AND time = ?", (setid, timeval))
res = cur.fetchall()
cur.close
if len(res) <> 0:
print "found a matching continuous data point"
db.execute("DELETE FROM dataset_values WHERE dataset_id = ? AND time = ?", (setid, timeval))
db.execute("DELETE FROM dataset_branchinfo WHERE dataset_id = ? AND time = ?", (setid, timeval))
db.execute("DELETE FROM dataset_extra_data WHERE dataset_id = ? AND time = ?", (setid, timeval))
db.execute("DELETE FROM annotations WHERE dataset_id = ? AND time = ?", (setid, timeval))
db.execute("INSERT INTO dataset_values (dataset_id, time, value) VALUES (?,?,?)", (setid, timeval, value))
db.execute("INSERT INTO dataset_branchinfo (dataset_id, time, branchid) VALUES (?,?,?)", (setid, timeval, branchid))
if data and data != "":