jeudi 19 février 2015

how to turn off SQLite autoindex feature?

My Android application uses SQLite and ORMLite to work with data. There is need to insert a big amount of data at one time and I want to make this faster than it is for this moment. For that I want to drop indexes then insert data and then recreate indexes.


Problem: is when application creates database - SQLite adds indexes to some fields in db automatically. They called sqlite_autoindex_%TableName%%ColumnName%_1


my ORM entites have fields marked to be indexed in db. And after creating tables ORMLite creates that indexes. SQLIte auto indexes dublicates indexes, created by ORMLIte so I need to configure SQLite to turn autoindexes off. I have found that this feature turns off with query "PRAGMA automatic_index = false;" So i overrided method of OrmLiteSqliteOpenHelper:



@Override
public SQLiteDatabase getWritableDatabase() {
SQLiteDatabase db = super.getWritableDatabase();
db.execSQL("PRAGMA automatic_index = false;");
return db;
}


That didn't help. Wrong place for query? Please help


Aucun commentaire:

Enregistrer un commentaire