DB config
This commit is contained in:
parent
61f1c8371d
commit
60517b922a
@ -17,15 +17,18 @@ except:
|
||||
exit(0)
|
||||
|
||||
|
||||
##
|
||||
### auf neue Files überwachen
|
||||
def main():
|
||||
global cursor
|
||||
try:
|
||||
try:
|
||||
db = sqlite3.connect(db_file)
|
||||
cursor = db.cursor()
|
||||
print("Connected to SQLite")
|
||||
except:
|
||||
print("Failed to connect to DB")
|
||||
|
||||
##
|
||||
### auf neue Files überwachen
|
||||
def main():
|
||||
global db, cursor
|
||||
try:
|
||||
updateLast()
|
||||
db.commit()
|
||||
print("Data updated successfully into bike_loading table")
|
||||
@ -44,7 +47,7 @@ def main():
|
||||
|
||||
|
||||
def updateLast():
|
||||
global cursor, watt
|
||||
global db, cursor, watt
|
||||
|
||||
## hole letztes Ladungs-Datum
|
||||
sql = '''
|
||||
@ -90,7 +93,7 @@ def updateLast():
|
||||
|
||||
|
||||
def insertNew():
|
||||
global cursor, loading
|
||||
global db, cursor, loading
|
||||
|
||||
date = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
|
||||
data = (date, loading)
|
||||
|
Loading…
Reference in New Issue
Block a user