This commit is contained in:
parent
cbcdfcf11e
commit
7655c068f4
|
@ -12,5 +12,5 @@ def db_connection(user, password, host):
|
||||||
connection = mysql.connector.connect(user=user, password=password, host=host)
|
connection = mysql.connector.connect(user=user, password=password, host=host)
|
||||||
except mysql.connector.Error as err:
|
except mysql.connector.Error as err:
|
||||||
print('Something went wrong', err)
|
print('Something went wrong', err)
|
||||||
print('Veruche deinen Mysql Server neuzustarten')
|
print('Veruche deinen Mysql Server neu zu starten')
|
||||||
return connection.cursor()
|
return connection.cursor()
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import database
|
import database
|
||||||
import database_connection
|
import database_connection
|
||||||
import config
|
import config
|
||||||
|
import main_menu
|
||||||
|
|
||||||
|
|
||||||
# Auskommentieren falls Server offline
|
# Auskommentieren falls Server offline
|
||||||
cursor = database_connection.db_connection(config.user, config.password, config.host)
|
|
||||||
|
|
||||||
|
|
||||||
# Datenbank Menü
|
# Datenbank Menü
|
||||||
|
@ -12,12 +13,13 @@ def menu():
|
||||||
selection = {0: 'Datenbanken anzeigen', 1: 'Datenbank erstellen', 2: 'Datenbank löschen', 3: 'Datenbank umbenennen',
|
selection = {0: 'Datenbanken anzeigen', 1: 'Datenbank erstellen', 2: 'Datenbank löschen', 3: 'Datenbank umbenennen',
|
||||||
4: 'Datenbank auselesen',
|
4: 'Datenbank auselesen',
|
||||||
5: 'Tabelle erstellen', 6: 'Tabelle umbenennen', 7: 'Tabelle löschen', 8: 'Tabelle auselsen',
|
5: 'Tabelle erstellen', 6: 'Tabelle umbenennen', 7: 'Tabelle löschen', 8: 'Tabelle auselsen',
|
||||||
9: 'In Tabelle einfügen', 10: 'Tabellen anzeigen'}
|
9: 'In Tabelle einfügen', 10: 'Tabellen anzeigen', 11: 'Zurück zum Hauptmenü'}
|
||||||
|
|
||||||
print('#Datenbank Menü# \n'
|
print('#Datenbank Menü# \n'
|
||||||
'\nWas möchtest du tun?\n')
|
'\nWas möchtest du tun?\n')
|
||||||
|
|
||||||
while enable_menu:
|
while enable_menu:
|
||||||
|
cursor = database_connection.db_connection(config.user, config.password, config.host)
|
||||||
for key, value in selection.items():
|
for key, value in selection.items():
|
||||||
print(key, value)
|
print(key, value)
|
||||||
selection_number = int(input('Bitte Auswahl treffen'))
|
selection_number = int(input('Bitte Auswahl treffen'))
|
||||||
|
@ -42,5 +44,22 @@ def menu():
|
||||||
print('#Tabelle erstellen#')
|
print('#Tabelle erstellen#')
|
||||||
table_name = input('Wie soll die Datenbank heißen?')
|
table_name = input('Wie soll die Datenbank heißen?')
|
||||||
database.create(cursor, table_name, _type)
|
database.create(cursor, table_name, _type)
|
||||||
|
case 6:
|
||||||
|
# TODO Funktion
|
||||||
|
return
|
||||||
|
case 7:
|
||||||
|
# TODO Funktion
|
||||||
|
return
|
||||||
|
case 8:
|
||||||
|
# TODO Funktion
|
||||||
|
return
|
||||||
|
case 9:
|
||||||
|
# TODO Funktion
|
||||||
|
return
|
||||||
|
case 10:
|
||||||
|
# TODO Funktion
|
||||||
|
return
|
||||||
|
case 11:
|
||||||
|
main_menu.main_menu()
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
# TODO: einlsen der berreits vorhanden Daten im JSON File
|
# TODO: einlesen der berreits vorhanden Daten im JSON File
|
9
main.py
9
main.py
|
@ -2,13 +2,20 @@
|
||||||
# Auswahlmenü ( Neue Fragen/ Oder Abfrage)
|
# Auswahlmenü ( Neue Fragen/ Oder Abfrage)
|
||||||
# Ein und Ausgabe der Fragen/Antworten
|
# Ein und Ausgabe der Fragen/Antworten
|
||||||
# Datenbanken (CRUD) Tabellen (CRUD)
|
# Datenbanken (CRUD) Tabellen (CRUD)
|
||||||
|
import time
|
||||||
|
|
||||||
import main_menu
|
import main_menu
|
||||||
import requirements_installer
|
import requirements_installer
|
||||||
|
|
||||||
# Aufruf des Main Menüse
|
|
||||||
|
# Aufruf des Main Menüs
|
||||||
def main():
|
def main():
|
||||||
|
print('Programm wird in 5 Sekunden gestartet, bitte gewährleiste, dass beim Programmstart dein Mysql Server '
|
||||||
|
'online ist\n')
|
||||||
|
time.sleep(5)
|
||||||
|
print('Installation vom Mysql Connector')
|
||||||
# requirements_installer.installer()
|
# requirements_installer.installer()
|
||||||
|
|
||||||
main_menu.main_menu()
|
main_menu.main_menu()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,4 +5,4 @@ import subprocess
|
||||||
# implement pip as a subprocess:
|
# implement pip as a subprocess:
|
||||||
def installer():
|
def installer():
|
||||||
subprocess.check_call([sys.executable, '-m', 'pip', 'install',
|
subprocess.check_call([sys.executable, '-m', 'pip', 'install',
|
||||||
'mysql-connector-python'])
|
'mysql-connector-python'])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user