diff --git a/database_connection.py b/database_connection.py index 893da52..42fe0f5 100644 --- a/database_connection.py +++ b/database_connection.py @@ -1 +1,12 @@ # TODO Database verbindung herstellen + +import mysql.connector + +def db_connection(user, password, host): + connection = None + + try: + connection = mysql.connector.connect(user, password, host) + except mysql.connector.Error as err: + print('Something went wrong' , err) + return connection.cursor() diff --git a/datenbank.py b/datenbank.py index f80d329..4e975e1 100644 --- a/datenbank.py +++ b/datenbank.py @@ -1,30 +1,33 @@ # TODO: Datenbank Klasse (CRUD) -def create_database(): +import database_connection + + +def create_database(db_cursor): # TODO Datenbank erstellen return -def create_table(): +def create_table(db_cursor): # TODO Table erstellen return -def add(): +def add(db_cursor): # TODO Frage / Antwort hinzufügen return -def read_question(): +def read_question(db_cursor): # TODO Frage / Antwort auslesen return -def update_question(): +def update_question(db_cursor): # TODO Frage / Antwort Aktualisieren return -def del_question(): +def del_question(db_cursor): # TODO Frage / Antworte löschen return diff --git a/main.py b/main.py index 9c636ef..c651130 100644 --- a/main.py +++ b/main.py @@ -2,3 +2,13 @@ # Auswahlmenü ( Neue Fragen/ Oder Abrfrage) # Ein und Ausgabe der Fragen/Antworten +import config +import database_connection + +def menue(): + # TODO Menü erstellen + return + + +def main(): + database_connection.db_connection(config.user, config.password, config.host) \ No newline at end of file