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