A little bit of extra logging.

This commit is contained in:
voussoir 2023-12-03 21:09:23 -08:00
parent 42311b446b
commit a27b8713a9

View file

@ -15,6 +15,7 @@ class Database(val trackbook: Trackbook)
fun close() fun close()
{ {
Log.i("VOUSSOIR", "Database.close")
this.connection.close() this.connection.close()
this.ready = false this.ready = false
this.ready_at = 0 this.ready_at = 0
@ -23,7 +24,7 @@ class Database(val trackbook: Trackbook)
fun connect(file: File) fun connect(file: File)
{ {
Log.i("VOUSSOIR", "Connecting to database " + file.absolutePath) Log.i("VOUSSOIR", "Database.connect: " + file.absolutePath)
this.file = file this.file = file
this.connection = openOrCreateDatabase(file, null) this.connection = openOrCreateDatabase(file, null)
this.initialize_tables() this.initialize_tables()
@ -196,6 +197,7 @@ class Database(val trackbook: Trackbook)
private fun initialize_tables() private fun initialize_tables()
{ {
Log.i("VOUSSOIR", "Database.initialize_tables")
begin_transaction() begin_transaction()
this.connection.execSQL("CREATE TABLE IF NOT EXISTS meta(name TEXT PRIMARY KEY, value TEXT)") this.connection.execSQL("CREATE TABLE IF NOT EXISTS meta(name TEXT PRIMARY KEY, value TEXT)")
this.connection.execSQL("CREATE TABLE IF NOT EXISTS trkpt(device_id INTEGER NOT NULL, time INTEGER NOT NULL, lat REAL NOT NULL, lon REAL NOT NULL, provider TEXT, accuracy REAL, ele INTEGER, sat INTEGER, PRIMARY KEY(device_id, time))") this.connection.execSQL("CREATE TABLE IF NOT EXISTS trkpt(device_id INTEGER NOT NULL, time INTEGER NOT NULL, lat REAL NOT NULL, lon REAL NOT NULL, provider TEXT, accuracy REAL, ele INTEGER, sat INTEGER, PRIMARY KEY(device_id, time))")