1 from logging import getLogger
2 from sqlite3 import connect
4 __all__ = ("initdb", "stow")
6 log = getLogger("gps303")
10 SCHEMA = """create table if not exists events (
11 timestamp real not null,
13 clntaddr text not null,
22 log.info('Using Sqlite3 database "%s"', dbname)
27 def stow(clntaddr, timestamp, imei, length, proto, payload):
31 ("clntaddr", "timestamp", "imei", "length", "proto", "payload"),
32 (str(clntaddr), timestamp, imei, length, proto, payload),
36 """insert or ignore into events
37 (timestamp, imei, clntaddr, length, proto, payload)
39 (:timestamp, :imei, :clntaddr, :length, :proto, :payload)