Fix threading. Yeah. I've *fixed* threading.

This commit is contained in:
BasioMeusPuga
2017-11-14 19:34:42 +05:30
parent 390c33af62
commit 0ee39608c3
6 changed files with 62 additions and 39 deletions

View File

@@ -115,11 +115,16 @@ class DatabaseFunctions:
self.close_database()
def modify_position(self, file_hash, position):
pickled_position = pickle.dumps(position)
def modify_position(self, hash_position_pairs):
for i in hash_position_pairs:
file_hash = i[0]
position = i[1]
pickled_position = pickle.dumps(position)
sql_command = "UPDATE books SET Position = ? WHERE Hash = ?"
self.database.execute(sql_command, [sqlite3.Binary(pickled_position), file_hash])
sql_command = "UPDATE books SET Position = ? WHERE Hash = ?"
self.database.execute(sql_command, [sqlite3.Binary(pickled_position), file_hash])
self.database.commit()
self.close_database()