36 lines
681 B
Python
36 lines
681 B
Python
# TODO: Datenbank Klasse (CRUD)
|
|
import mysql.connector
|
|
|
|
|
|
def create_database(db_cursor, database_name):
|
|
query = f'CREATE DATABASE {database_name}'
|
|
try:
|
|
db_cursor.execute(query)
|
|
except mysql.connector.Error as err:
|
|
print('Something went wrong', err)
|
|
|
|
|
|
def create_table(db_cursor):
|
|
# TODO Frage / Antwort Tabellen erstellen
|
|
return
|
|
|
|
|
|
def add(db_cursor):
|
|
# TODO Frage / Antwort hinzufügen
|
|
return
|
|
|
|
|
|
def read_question(db_cursor):
|
|
# TODO Frage / Antwort auslesen
|
|
return
|
|
|
|
|
|
def update_question(db_cursor):
|
|
# TODO Frage / Antwort Aktualisieren
|
|
return
|
|
|
|
|
|
def del_question(db_cursor):
|
|
# TODO Frage / Antworte löschen
|
|
return
|