This commit is contained in:
parent
8b547bd786
commit
b80adf49e1
17
database.py
17
database.py
|
@ -2,34 +2,29 @@
|
||||||
import mysql.connector
|
import mysql.connector
|
||||||
|
|
||||||
|
|
||||||
def create_database(db_cursor, database_name):
|
def create(db_cursor, name):
|
||||||
query = f'CREATE DATABASE {database_name}'
|
query = f'CREATE DATABASE {name}'
|
||||||
try:
|
try:
|
||||||
db_cursor.execute(query)
|
db_cursor.execute(query)
|
||||||
except mysql.connector.Error as err:
|
except mysql.connector.Error as err:
|
||||||
print('Something went wrong', err)
|
print('Something went wrong', err)
|
||||||
|
|
||||||
|
|
||||||
def create_table(db_cursor):
|
|
||||||
# TODO Frage / Antwort Tabellen erstellen
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
def add(db_cursor):
|
def add(db_cursor):
|
||||||
# TODO Frage / Antwort hinzufügen
|
# TODO Frage / Antwort hinzufügen
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def read_question(db_cursor):
|
def read(db_cursor):
|
||||||
# TODO Frage / Antwort auslesen
|
# TODO Frage / Antwort auslesen
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def update_question(db_cursor):
|
def update(db_cursor):
|
||||||
# TODO Frage / Antwort Aktualisieren
|
# TODO Frage / Antwort Aktualisieren
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def del_question(db_cursor):
|
def del_(db_cursor):
|
||||||
# TODO Frage / Antworte löschen
|
# TODO Frage / Antwort löschen
|
||||||
return
|
return
|
||||||
|
|
2
main.py
2
main.py
|
@ -25,7 +25,7 @@ def menu():
|
||||||
case 1:
|
case 1:
|
||||||
print('#Datenbank erstellen#') # Platzhalter für die Funktion
|
print('#Datenbank erstellen#') # Platzhalter für die Funktion
|
||||||
database_name = input('Wie soll die Datenbank heißen?')
|
database_name = input('Wie soll die Datenbank heißen?')
|
||||||
database.create_database(cursor)
|
database.create(cursor,database_name)
|
||||||
case 2:
|
case 2:
|
||||||
print('Datenbank löschen') # Platzhalter für die Funktion
|
print('Datenbank löschen') # Platzhalter für die Funktion
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue
Block a user