This commit is contained in:
marcus 2022-03-17 13:22:44 +01:00
parent 4ae2368f80
commit 5678c31efb
3 changed files with 30 additions and 6 deletions

View File

@ -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()

View File

@ -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

10
main.py
View File

@ -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)