# TODO: Datenbank Klasse (CRUD) import mysql.connector # Create Database or Table def create(db_cursor, name, type_): query = f'CREATE {type_} {name};' print(query) try: db_cursor.execute(query) except mysql.connector.Error as err: print('Something went wrong', err) def read(db_cursor, name, type_): # TODO return def update(db_cursor, name, type_): # TODO return def del_(db_cursor, name, type_): query = f'DROP {type_} IF EXISTS {name};' try: db_cursor.execute(query) except mysql.connector.Error as err: print('Something went wrong', err) def add(db_cursor, name, type_, question, answer): query = f'INSERT INTO {type_} {name} (question, answer)' val = f'values ({question},{answer});' db_cursor.execute(query, val) return def show(db_cursor, type_): query = f'SHOW {type_};' try: db_cursor.execute(query) except mysql.connector.Error as err: print('Something went wrong', err)