„database_menu.py“ löschen
This commit is contained in:
parent
b2109fb773
commit
cd40a85237
|
@ -1,80 +0,0 @@
|
||||||
import database
|
|
||||||
import database_connection
|
|
||||||
import config
|
|
||||||
import main_menu
|
|
||||||
|
|
||||||
|
|
||||||
# Datenbank Menü
|
|
||||||
def menu():
|
|
||||||
connection = database_connection.db_connection(config.user, config.password, config.host, None)
|
|
||||||
|
|
||||||
selection = {0: ' Datenbanken anzeigen', 1: ' Datenbank erstellen', 2: ' Datenbank löschen', 3: ' Datenbank umbenennen',
|
|
||||||
4: ' Datenbanken benutzen',
|
|
||||||
5: ' Tabelle erstellen', 6: ' Tabelle umbenennen', 7: ' Tabelle löschen', 8: ' Tabelle auslesen',
|
|
||||||
9: ' In Tabelle einfügen', 10: 'Tabellen anzeigen', 11: 'Frage/Antwort hinzufügen', 12: 'Zurück zum Hauptmenü'}
|
|
||||||
|
|
||||||
print('#Datenbank Menü# \n'
|
|
||||||
'\nWas möchtest du tun?\n')
|
|
||||||
|
|
||||||
while True:
|
|
||||||
|
|
||||||
cursor = connection.cursor()
|
|
||||||
for key, value in selection.items():
|
|
||||||
print(key, value)
|
|
||||||
selection_number = int(input('\nBitte Auswahl treffen\n'))
|
|
||||||
|
|
||||||
match selection_number:
|
|
||||||
case 0:
|
|
||||||
use_type = 'DATABASES'
|
|
||||||
print('# Datenbanken #\n')
|
|
||||||
database.show(cursor, use_type)
|
|
||||||
case 1:
|
|
||||||
use_type = 'DATABASE'
|
|
||||||
print('# Datenbank erstellen #\n')
|
|
||||||
database_name = input('Wie soll die Datenbank heißen?\n')
|
|
||||||
database.create(cursor, database_name, use_type)
|
|
||||||
case 2:
|
|
||||||
use_type = 'DATABASE'
|
|
||||||
print('# Datenbank löschen #\n') # Platzhalter für die Funktion
|
|
||||||
database_name = input('Welche Datenbank soll gelöscht werden?\n')
|
|
||||||
database.del_(cursor, database_name, use_type)
|
|
||||||
case 3:
|
|
||||||
print('--Funktion ist in Arbeit-- \n')
|
|
||||||
continue
|
|
||||||
case 4:
|
|
||||||
name = input('Welche Datenbank möchtest du benutzen?\n')
|
|
||||||
database.use(cursor, name)
|
|
||||||
connection.database = name
|
|
||||||
case 5:
|
|
||||||
use_type = 'TABLE'
|
|
||||||
print('# Tabelle erstellen #\n')
|
|
||||||
table_name = input('Wie soll die Datenbank heißen?\n')
|
|
||||||
database.create(cursor, table_name, use_type)
|
|
||||||
case 6:
|
|
||||||
print('--Funktion ist in Arbeit-- \n')
|
|
||||||
continue
|
|
||||||
case 7:
|
|
||||||
print('--Funktion ist in Arbeit-- \n')
|
|
||||||
continue
|
|
||||||
case 8:
|
|
||||||
print('# Tabelle Auslesen #\n')
|
|
||||||
name = input('Aus welcher Tabelle soll dir alles angezeigt werden?\n')
|
|
||||||
database.read(cursor, name)
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
print('--Funktion ist in Arbeit-- \n')
|
|
||||||
continue
|
|
||||||
case 10:
|
|
||||||
database.show_tables(cursor)
|
|
||||||
print(str(cursor.fetchall()).replace(',', ''))
|
|
||||||
return
|
|
||||||
case 11:
|
|
||||||
table_name = str(input('Bitte den Tabellennamen angeben\n'))
|
|
||||||
print("#Fragen und Antworten hinzufügen #\n")
|
|
||||||
question = str(input('Bitte die Frage eingeben\n'))
|
|
||||||
answer = str(input('Bitte die dazugehörige antwort eingeben\n'))
|
|
||||||
database.add(cursor, table_name, question, answer)
|
|
||||||
case 12:
|
|
||||||
main_menu.main_menu()
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user