Table editing, Traverse and associate with tags all paths entered

This commit is contained in:
BasioMeusPuga
2017-11-30 01:20:30 +05:30
parent 5064398481
commit 69392c5d4f
9 changed files with 138 additions and 78 deletions

View File

@@ -38,11 +38,10 @@ class DatabaseFunctions:
name = i[1]
tags = i[2]
# TODO
# Get insert or replace working
sql_command = ("INSERT OR REPLACE INTO directories (Path,Name,Tags) VALUES (?, ?, ?)")
self.database.execute(sql_command, [path, name, tags])
sql_command = (
"INSERT OR REPLACE INTO directories (ID, Path, Name, Tags)\
VALUES ((SELECT ID FROM directories WHERE Path = ?), ?, ?, ?)")
self.database.execute(sql_command, [path, path, name, tags])
self.database.commit()
self.close_database()