diff --git a/insertLoading.py b/insertLoading.py index 9e6cca5..8544c8c 100644 --- a/insertLoading.py +++ b/insertLoading.py @@ -8,7 +8,6 @@ import sqlite3 db_file = "/www/wwwroot/www.manuelw.de/ebike/ebike.db" -fitFilesCount = 0 try: loading = sys.argv[1] @@ -27,7 +26,13 @@ def main(): print("Connected to SQLite") updateLast(cursor) + db.commit() + print("Data updated successfully into bike_loading table") + insertNew(cursor) + db.commit() + print("Data inserted successfully into bike_drives table") + cursor.close() except sqlite3.Error as error: print("Failed to insert data into sqlite table", error) @@ -81,8 +86,6 @@ def updateLast(cursor): WHERE id = ? ''' cursor.execute(sql, data) - db.commit() - print("Data updated successfully into bike_loading table") def insertNew(cursor): @@ -98,9 +101,6 @@ def insertNew(cursor): ''' cursor.execute(sql, data) - db.commit() - print("Data inserted successfully into bike_drives table") - cursor.close() if __name__ == '__main__':