This commit is contained in:
parent
fa472b5264
commit
ef7d93b244
12
database.py
12
database.py
|
@ -1,6 +1,5 @@
|
|||
# TODO: Datenbank Klasse (CRUD)
|
||||
|
||||
import database_connection
|
||||
import mysqlx
|
||||
|
||||
|
||||
def create_database(db_cursor):
|
||||
|
@ -8,9 +7,12 @@ def create_database(db_cursor):
|
|||
return
|
||||
|
||||
|
||||
def create_table(db_cursor):
|
||||
# TODO Table erstellen
|
||||
return
|
||||
def create_table(db_cursor, database_name):
|
||||
query = f'CREATE DATABASE {database_name}'
|
||||
try:
|
||||
db_cursor.execute(query)
|
||||
except mysqlx.Error as err:
|
||||
print('Something went wrong', err)
|
||||
|
||||
|
||||
def add(db_cursor):
|
||||
|
|
3
main.py
3
main.py
|
@ -23,7 +23,8 @@ def menu():
|
|||
|
||||
match selection_number:
|
||||
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.create_database(cursor)
|
||||
case 2:
|
||||
print('Datenbank löschen') # Platzhalter für die Funktion
|
||||
|
|
Loading…
Reference in New Issue
Block a user