Add missing fields and try to catch sqlite errors.
This commit is contained in:
parent
7453d50598
commit
ef5765e87f
|
@ -31,6 +31,11 @@ db_fields = ("id",
|
||||||
"object_name",
|
"object_name",
|
||||||
"path",
|
"path",
|
||||||
"phg",
|
"phg",
|
||||||
|
"phg_dir",
|
||||||
|
"phg_gain",
|
||||||
|
"phg_height",
|
||||||
|
"phg_power",
|
||||||
|
"phg_range",
|
||||||
"posambiguity",
|
"posambiguity",
|
||||||
"raw",
|
"raw",
|
||||||
"raw_timestamp",
|
"raw_timestamp",
|
||||||
|
@ -95,7 +100,7 @@ def main():
|
||||||
attrib_values = ", ".join("?" * len(a.keys()))
|
attrib_values = ", ".join("?" * len(a.keys()))
|
||||||
#sql = f"INSERT INTO frames ({attrib_names}) VALUES ({attrib_values})"
|
#sql = f"INSERT INTO frames ({attrib_names}) VALUES ({attrib_values})"
|
||||||
sql = "INSERT INTO frames ("+attrib_names+") VALUES ("+attrib_values+")"
|
sql = "INSERT INTO frames ("+attrib_names+") VALUES ("+attrib_values+")"
|
||||||
print(sql)
|
try:
|
||||||
# Insert data
|
# Insert data
|
||||||
conn.execute(sql, list(a.values()))
|
conn.execute(sql, list(a.values()))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
@ -104,6 +109,8 @@ def main():
|
||||||
# "5 minutes" also works
|
# "5 minutes" also works
|
||||||
conn.execute("DELETE FROM frames WHERE created < DATETIME('now', '"+config['Settings']['keep_time']+"')")
|
conn.execute("DELETE FROM frames WHERE created < DATETIME('now', '"+config['Settings']['keep_time']+"')")
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
except:
|
||||||
|
print("Error with SQLite!")
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,12 @@ CREATE TABLE frames (
|
||||||
object_format TEXT,
|
object_format TEXT,
|
||||||
object_name TEXT,
|
object_name TEXT,
|
||||||
path TEXT,
|
path TEXT,
|
||||||
phg TEXT,
|
phg REAL,
|
||||||
|
phg_dir TEXT,
|
||||||
|
phg_gain REAL,
|
||||||
|
phg_height REAL,
|
||||||
|
phg_power REAL,
|
||||||
|
phg_range REAL,
|
||||||
posambiguity INT,
|
posambiguity INT,
|
||||||
raw TEXT,
|
raw TEXT,
|
||||||
raw_timestamp TEXT,
|
raw_timestamp TEXT,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user