DB config
This commit is contained in:
parent
592866e27c
commit
61f1c8371d
@ -20,16 +20,17 @@ except:
|
||||
##
|
||||
### auf neue Files überwachen
|
||||
def main():
|
||||
global cursor
|
||||
try:
|
||||
db = sqlite3.connect(db_file)
|
||||
cursor = db.cursor()
|
||||
print("Connected to SQLite")
|
||||
|
||||
updateLast(cursor)
|
||||
updateLast()
|
||||
db.commit()
|
||||
print("Data updated successfully into bike_loading table")
|
||||
|
||||
insertNew(cursor)
|
||||
insertNew()
|
||||
db.commit()
|
||||
print("Data inserted successfully into bike_drives table")
|
||||
cursor.close()
|
||||
@ -42,8 +43,8 @@ def main():
|
||||
print("The SQLite connection is closed")
|
||||
|
||||
|
||||
def updateLast(cursor):
|
||||
global watt
|
||||
def updateLast():
|
||||
global cursor, watt
|
||||
|
||||
## hole letztes Ladungs-Datum
|
||||
sql = '''
|
||||
@ -88,8 +89,8 @@ def updateLast(cursor):
|
||||
cursor.execute(sql, data)
|
||||
|
||||
|
||||
def insertNew(cursor):
|
||||
global loading
|
||||
def insertNew():
|
||||
global cursor, loading
|
||||
|
||||
date = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
|
||||
data = (date, loading)
|
||||
|
Loading…
Reference in New Issue
Block a user