public boolean updateTournaItemWinner(ATPSchedule scheduleItem) { String winner = scheduleItem.getTournaWinner(); ContentValues cv = new ContentValues(); cv.put(AppDatabase.TournasDatabase.WINNER, winner); String WHERE = AppDatabase.TournasDatabase.TOURNA_ID + "=" + scheduleItem.getTournaId() + " AND " + AppDatabase.TournasDatabase.WINNER + "<>" + "'" + winner + "'"; int rowsUpdated = getWritableDatabase().update(AppDatabase.TournasDatabase.TABLE_NAME, cv, WHERE, null); return rowsUpdated > 0 ? true : false; }
public boolean updateTournaItemStarFlag(ATPSchedule scheduleItem, boolean isStarred) { ContentValues cv = new ContentValues(); cv.put(AppDatabase.TournasDatabase.IS_STARRED, isStarred); int rowsUpdated = getWritableDatabase() .update( AppDatabase.TournasDatabase.TABLE_NAME, cv, AppDatabase.TournasDatabase.TOURNA_ID + "=" + scheduleItem.getTournaId(), null); return rowsUpdated > 0 ? true : false; }
public boolean updateTournaItemEventFlag(ATPSchedule scheduleItem, long eventId) { ContentValues cv = new ContentValues(); cv.put(AppDatabase.TournasDatabase.EVENT_ID, eventId); int rowsUpdated = getWritableDatabase() .update( AppDatabase.TournasDatabase.TABLE_NAME, cv, AppDatabase.TournasDatabase.TOURNA_ID + "=" + scheduleItem.getTournaId(), null); return rowsUpdated > 0 ? true : false; }
public long insertTournaItem(ATPSchedule tournaItem) { ContentValues cv = new ContentValues(); cv.put(AppDatabase.TournasDatabase.TOURNA_ID, tournaItem.getTournaId()); cv.put(AppDatabase.TournasDatabase.NAME, tournaItem.getTournaName()); cv.put(AppDatabase.TournasDatabase.DATE_NUMBER, tournaItem.getTournaDay()); cv.put(AppDatabase.TournasDatabase.DATE_MONTH, tournaItem.getTournaMonth()); cv.put(AppDatabase.TournasDatabase.DATE_YEAR, tournaItem.getTournaYear()); cv.put(AppDatabase.TournasDatabase.DATE_WEEK_START, tournaItem.getTournaWeekStart()); cv.put(AppDatabase.TournasDatabase.DATE_WEEK_END, tournaItem.getTournaWeekEnd()); cv.put(AppDatabase.TournasDatabase.CITY, tournaItem.getTournaCity()); cv.put(AppDatabase.TournasDatabase.COUNTRY, tournaItem.getTournaCountry()); cv.put(AppDatabase.TournasDatabase.SURFACE, tournaItem.getTournaSurface()); cv.put(AppDatabase.TournasDatabase.IS_SLAM, tournaItem.getTournaSlam()); cv.put(AppDatabase.TournasDatabase.IS_PREMIER, tournaItem.getTournaPremier()); cv.put(AppDatabase.TournasDatabase.LINK, tournaItem.getTournaWebSite()); cv.put(AppDatabase.TournasDatabase.MAP_TILE_NAME, tournaItem.getTournaMapTile()); cv.put(AppDatabase.TournasDatabase.MAP_URL, tournaItem.getTournaMapUrl()); cv.put(AppDatabase.TournasDatabase.IS_STARRED, tournaItem.getIsStarred()); cv.put(AppDatabase.TournasDatabase.IS_SHARED, tournaItem.getIsShared()); cv.put(AppDatabase.TournasDatabase.WINNER, tournaItem.getTournaWinner()); cv.put(AppDatabase.TournasDatabase.PRIZE, tournaItem.getTournaPrizeMoney()); cv.put(AppDatabase.TournasDatabase.POINTS, tournaItem.getTournaPoints()); cv.put(AppDatabase.TournasDatabase.SHARE_TEXT, tournaItem.getTournaShareText()); return getWritableDatabase() .insertWithOnConflict( AppDatabase.TournasDatabase.TABLE_NAME, null, cv, SQLiteDatabase.CONFLICT_IGNORE); }