Pruefungskatalog/database.py
2022-03-18 15:06:02 +01:00

38 lines
668 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, name, type_):
# TODO
return
def read(db_cursor, name, type_):
# TODO
return
def update(db_cursor, name, type_):
# TODO
return
def del_(db_cursor, name, type_):
query = f'DROP if exists {type_} {name}'
try:
db_cursor.execute(query)
except mysql.connector.Error as err:
print('Something went wrong', err)