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()
sql_code = """
CREATE TABLE IF NOT EXISTS movies(
'id' INTEGER AUTOINCREMENT,
'name' TEXT PRIMARY KEY,
'id' INTEGER PRIMARY KEY AUTOINCREMENT,
'name' TEXT,
'filmgenres' TEXT,
'year' TEXT,
'persönlich' TEXT
@@ -40,13 +40,22 @@ class db_work:
cursor.execute(sql)
if not cursor.fetchone():
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:
print("Film bereits vorhanden !")
print("Eingabevorgang wurde beendet.")
def speicher_aktion():
pass
def speicher_aktion(self, movie = str, filmgenre = str, year = str, persönlich = str):
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):
with sqlite3.connect(self.db_file) as con_db:

Binary file not shown.