Skip to content

Commit

Permalink
Fix using Connection as Cursor.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thynix committed Dec 9, 2012
1 parent 90b4c26 commit 06766a4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ def insert(args, probe_type, result, duration):
elif probe_type == "IDENTIFIER":
db.execute("insert into identifier(time, htl, identifier, percent, duration) values(?, ?, ?, ?, ?)", (now, htl, result[PROBE_IDENTIFIER], result[UPTIME_PERCENT], duration))
elif probe_type == "LINK_LENGTHS":
cur = db.cursor()
lengths = split(result[LINK_LENGTHS], ';')
db.execute("insert into peer_count(time, htl, peers, duration) values(?, ?, ?, ?)", (now, htl, len(lengths), duration))
new_id = db.lastrowid
cur.execute("insert into peer_count(time, htl, peers, duration) values(?, ?, ?, ?)", (now, htl, len(lengths), duration))
new_id = cur.lastrowid
for length in lengths:
db.execute("insert into link_lengths(time, htl, length, id) values(?, ?, ?, ?)", (now, htl, length, new_id))
cur.execute("insert into link_lengths(time, htl, length, id) values(?, ?, ?, ?)", (now, htl, length, new_id))
cur.close()
elif probe_type == "LOCATION":
db.execute("insert into location(time, htl, location, duration) values(?, ?, ?, ?)", (now, htl, result[LOCATION], duration))
elif probe_type == "STORE_SIZE":
Expand Down

0 comments on commit 06766a4

Please sign in to comment.