From 3d0755f09c0cfacbf8a84b70a76dda242586ff19 Mon Sep 17 00:00:00 2001 From: Georg Lukas Date: Mon, 13 Dec 2010 16:48:47 +0100 Subject: [PATCH] add index to position table --- src/StorageDatabase.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/StorageDatabase.scala b/src/StorageDatabase.scala index 75b473a..c211a50 100644 --- a/src/StorageDatabase.scala +++ b/src/StorageDatabase.scala @@ -10,7 +10,7 @@ import _root_.android.widget.FilterQueryProvider object StorageDatabase { val TAG = "StorageDatabase" - val DB_VERSION = 3 + val DB_VERSION = 4 val DB_NAME = "storage.db" object Post { val TABLE = "posts" @@ -45,6 +45,7 @@ object StorageDatabase { lazy val TABLE_CREATE = "CREATE TABLE %s (%s INTEGER PRIMARY KEY AUTOINCREMENT, %s LONG, %s TEXT, %s INTEGER, %s INTEGER, %s TEXT, %s TEXT)" .format(TABLE, _ID, TS, CALL, LAT, LON, SYMBOL, COMMENT) lazy val COLUMNS = Array(_ID, TS, CALL, LAT, LON, SYMBOL, COMMENT) + lazy val TABLE_INDEX = "CREATE INDEX idx_position_%s ON position (%s)" } var singleton : StorageDatabase = null @@ -85,6 +86,9 @@ class StorageDatabase(context : Context) extends } c.close() } + if (from <= 3 && to >= 4) { + Array("call", "lat", "lon").map(col => db.execSQL(Position.TABLE_INDEX.format(col, col))) + } } def trimPosts(ts : Long) {