storage: add index for 'ts'

storage_ts_index
Georg Lukas 2011-04-12 15:45:15 +02:00
rodzic 8892d43423
commit 470d0e6334
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -14,7 +14,7 @@ import _root_.scala.math.{cos, Pi}
object StorageDatabase {
val TAG = "StorageDatabase"
val DB_VERSION = 1
val DB_VERSION = 2
val DB_NAME = "storage.db"
object Post {
val TABLE = "posts"
@ -96,12 +96,12 @@ class StorageDatabase(context : Context) extends
Log.d(TAG, "onCreate(): creating new database " + DB_NAME);
db.execSQL(Post.TABLE_CREATE);
db.execSQL(Position.TABLE_CREATE)
Array("call", "lat", "lon").map(col => db.execSQL(Position.TABLE_INDEX.format(col, col)))
Array("ts", "call", "lat", "lon").map(col => db.execSQL(Position.TABLE_INDEX.format(col, col)))
}
def resetPositionsTable(db : SQLiteDatabase) {
db.execSQL(Position.TABLE_DROP)
db.execSQL(Position.TABLE_CREATE)
Array("call", "lat", "lon").map(col => db.execSQL(Position.TABLE_INDEX.format(col, col)))
Array("ts", "call", "lat", "lon").map(col => db.execSQL(Position.TABLE_INDEX.format(col, col)))
return; // this code causes a too long wait in onUpgrade...
// we can not call getPosts() here due to recursion issues
val c = db.query(Post.TABLE, Post.COLUMNS, "TYPE = 0 OR TYPE = 3",