optimize cmd history

This commit is contained in:
2024-06-18 12:52:18 +02:00
parent a6f70d9492
commit 9999a5fd42
2 changed files with 14 additions and 6 deletions

View File

@@ -72,9 +72,11 @@ def createFilterTable(file):
print("db connection:",connection.total_changes)
def addFineFilter(file,table,filterstr):
with sqlite3.connect(file) as connection:
cmd = f"""INSERT INTO {table}(cmd) VALUES(?);"""
cmd_createFineFilter = f"""INSERT INTO {table}(cmd) VALUES(?);"""
cmd_checkIfExists = f"""SELECT * FROM {table} WHERE cmd = ?"""
cursor = connection.cursor()
cursor.execute(cmd,(filterstr,))
if cursor.execute(cmd_checkIfExists,(filterstr,)).fetchone() == None:
cursor.execute(cmd_createFineFilter,(filterstr,))
def writedb(jobs):
with sqlite3.connect("../db/sqlite3.db") as connection: