mirror of
https://amiok.net/gitea/W1CDN/aprs_tool.git
synced 2025-07-26 21:36:15 +00:00
Snapshot after adding station table update code, but hasn't been tested on real frames yet.
This commit is contained in:
@@ -66,7 +66,18 @@ def main():
|
||||
conn.execute(sql, list(a.values()))
|
||||
|
||||
# TODO update stations table here
|
||||
|
||||
# Original intent was to include the id from the frames table,
|
||||
# but that would mean making another conn.commit() (I think).
|
||||
# It's not immediately needed, so I'm skipping it.
|
||||
# Build query
|
||||
# "from" is wrappedin [] because it is a reserved word and using '' doesn't work.
|
||||
station_update = ", ".join((a['from'], a['created_unix'], "1"))
|
||||
query3 = "INSERT INTO stations ([from], last_heard_unix, count) \
|
||||
VALUES("+station_update+", 1) \
|
||||
ON CONFLICT([from]) \
|
||||
DO UPDATE SET count = count + 1;"
|
||||
# Insert/update data
|
||||
conn.execute(query3)
|
||||
|
||||
conn.commit()
|
||||
|
||||
|
Reference in New Issue
Block a user