commit message from python script

This commit is contained in:
2023-11-15 22:19:25 +01:00
parent 95bc2ebe2e
commit 728abc4a77
2 changed files with 14 additions and 5 deletions

View File

@@ -9,8 +9,8 @@ class db_work:
cursor = con_db.cursor() cursor = con_db.cursor()
sql_code = """ sql_code = """
CREATE TABLE IF NOT EXISTS movies( CREATE TABLE IF NOT EXISTS movies(
'id' INTEGER AUTOINCREMENT, 'id' INTEGER PRIMARY KEY AUTOINCREMENT,
'name' TEXT PRIMARY KEY, 'name' TEXT,
'filmgenres' TEXT, 'filmgenres' TEXT,
'year' TEXT, 'year' TEXT,
'persönlich' TEXT 'persönlich' TEXT
@@ -40,13 +40,22 @@ class db_work:
cursor.execute(sql) cursor.execute(sql)
if not cursor.fetchone(): if not cursor.fetchone():
print("Film wird angelgt ") print("Film wird angelgt ")
#self.speicher_aktion(name, ort, vorfall) self.speicher_aktion(movie=name, filmgenre=movie_genre, year=movie_year, persönlich=per_info)
else: else:
print("Film bereits vorhanden !") print("Film bereits vorhanden !")
print("Eingabevorgang wurde beendet.") print("Eingabevorgang wurde beendet.")
def speicher_aktion(): def speicher_aktion(self, movie = str, filmgenre = str, year = str, persönlich = str):
pass with sqlite3.connect(self.db_file) as verbindung:
cursor = verbindung.cursor()
sql = """INSERT INTO movies(name, filmgenres, year, 'persönlich' )
VALUES ( '{movie}', '{filmgenre}', '{year}', '{persönlich}' );""".format(
movie=movie,
filmgenre=filmgenre,
year=year,
persönlich=persönlich)
cursor.execute(sql)
def show_value(self, sql_query = str): def show_value(self, sql_query = str):
with sqlite3.connect(self.db_file) as con_db: with sqlite3.connect(self.db_file) as con_db:

Binary file not shown.