Initial commit

This commit is contained in:
michaela.buzalkova
2025-09-30 08:22:44 +02:00
commit b45a8b2d00
29 changed files with 1486 additions and 0 deletions

37
GetFunctions.py Normal file
View File

@@ -0,0 +1,37 @@
import hashlib
def create_entry_hash(cfilename, isize, ctime, mtime):
entryhash = ""
entryhash = hashlib.md5(
cfilename.upper().encode() + str(isize).encode() + str(ctime).encode() + str(mtime).encode()).hexdigest()
return (entryhash)
def create_filename_hash(cfilename):
filenamehash = ""
filenamehash = hashlib.md5(cfilename.upper().encode()).hexdigest()
return (filenamehash)
def delete_all_from_tfolders(cursor, connection):
cursor.execute("delete from tFolders")
connection.commit()
def check_folder_exists(folder, connection):
curtmp = connection.cursor()
escfolder = connection.escape_string(folder)
print(escfolder)
pocettmp = curtmp.execute("select id from tFolders where cfoldername=%s", escfolder)
if pocettmp == 0:
return [0, 0]
else:
return [pocettmp, curtmp.fetchone()[0]]
def set_sql_mode_no_escape(cursor):
cursor.execute("SELECT @@sql_mode")
newmode = cursor.fetchone()[0]
newmode = newmode + ",NO_BACKSLASH_ESCAPES"
cursor.execute("set @@sql_mode=%s", newmode)