In my application, i have to insert or updated Bulk of record in SQLite database android, record size may 3000 or larger,
String query="SELECT * FROM tableName where "+id+" = "+bean.id()+" and "+other_id+" = "+bean.otherID();
Cursor mCount= db.rawQuery(query , null);
mCount.moveToFirst();
row=mCount.getCount();
mCount.close();
/**
* Insert here
*/
if(row==0){
ContentValues values = new ContentValues();
values.put(key, "value");
values.put(key, "value");
db.insert("tableName", null, values);
}
/**
* Updated here
*/
else{
ContentValues values = new ContentValues();
values.put(key, "value");
values.put(key, "value");
db.update("tableName", values, "id"+" = ? and "+"other_id"+" = ? ", new String[] {bena.id(),bean.otherid});
}
this code is work fine, but take so much time, how to reduce this time, or bulk insert or update record.