32 lines
572 B
Python
32 lines
572 B
Python
# TODO: Datenbank Klasse (CRUD)
|
|
import mysql.connector
|
|
|
|
|
|
# Create Database or Table
|
|
def create(db_cursor, name, _type):
|
|
query = f'CREATE {_type} {name}'
|
|
try:
|
|
db_cursor.execute(query)
|
|
except mysql.connector.Error as err:
|
|
print('Something went wrong', err)
|
|
|
|
|
|
def add(db_cursor):
|
|
# TODO Frage / Antwort hinzufügen
|
|
return
|
|
|
|
|
|
def read(db_cursor):
|
|
# TODO Frage / Antwort auslesen
|
|
return
|
|
|
|
|
|
def update(db_cursor):
|
|
# TODO Frage / Antwort Aktualisieren
|
|
return
|
|
|
|
|
|
def del_(db_cursor):
|
|
# TODO Frage / Antwort löschen
|
|
return
|