Posts

Crud Config

SQLiteOpenHelper Get capability of SQLite operation need extends SQLiteOpenHelper extends SQLiteOpenHelper{ private static final String DATABASE_NAME = "simple" ; private static final String TABLE_NAME = "user" ; private static final int VERSION_NUMBER = 1 ; SQLiteDatabase db ; private static final String tableCreateQuery = "CREATE TABLE IF NOT EXISTS user (_id integer primary key autoincrement, name text, email text, password text);" ; private static final String TABLE_DROP_QUERY = "DROP TABLE IF EXISTS " + TABLE_NAME ; public DatabaseHelper(Context context) { super (context, DATABASE_NAME , null , VERSION_NUMBER ); } public void onCreate(SQLiteDatabase db) { db.execSQL( tableCreateQuery ); } public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL( TABLE_DROP_QUERY ); onCreate(db); } Some useful query for CRUD action with sqlite // re