add index to position table

itemized2sql
Georg Lukas 2010-12-13 16:48:47 +01:00
rodzic 330766d134
commit 3d0755f09c
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -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) {