lundi 30 mars 2015

Drop table if exits not works on SQlite database in Android

I have a SQLite Database on Database, I store that database from PHP Server, I crete database, If I add new values to PHP databse it's appear on my android device, but...


MY PROBLEM


When I delete one value to Server database, on my device not delete from sqlite database, database is not updated only when I delete values from php database but yes works when I add values...


code DDBB



public class BBDD extends SQLiteOpenHelper
{
private static final String KEY_ID = "id";

String crear = "CREATE TABLE types(KEY_ID INTEGER PRIMARY KEY," +
"value TEXT) ";


public BBDD (Context contexto, String nombre, CursorFactory factory,
int version)
{
super(contexto, nombre, factory, version);
}

public void onCreate (SQLiteDatabase db)
{
db.execSQL(crear);
}

public void onUpgrade (SQLiteDatabase db, int versionAnt, int versionNue)
{
db.execSQL("DROP TABLE IF EXISTS types");
db.execSQL(crear);

}


Why not works DROP TABLE IF EXITS?


Any suggestions?


Aucun commentaire:

Enregistrer un commentaire