Code example for SQLiteOpenHelper

Methods: getWritableDatabase

0
	// safety wrappers 
	// in case of getReadableDatabase it could happen that upgradeDB gets called which is  
	// a problem if the DB is only readable 
	private SQLiteDatabase getWritableDatabase()
	{ 
		return historyDB.getWritableDatabase();		
	} 
 
	private SQLiteDatabase getReadableDatabase()
	{ 
		SQLiteDatabase db;
		try { 
			db = historyDB.getReadableDatabase();			
		} 
		catch(SQLiteException e) {
			db = historyDB.getWritableDatabase();
		} 
		return db;		
	}	 
}