public static long update(SQLiteDatabase db, PageTimer timer, String pageId, String lang) throws SQLException { ContentValues cv = new ContentValues(); cv.put(TIMER_INFO, timer.getInfo()); cv.put(TIMER_INACTIVE, timer.getInactive()); cv.put(TIMER_FAIL, timer.getFail()); return db.update( TABLE_PAGE_TIMER, cv, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[] {pageId, lang}); }
public static long insert(SQLiteDatabase db, PageTimer timer, String pageId, String lang) throws SQLException { SQLiteStatement insertStatement = db.compileStatement(INSERT_SQL); if (pageId != null) insertStatement.bindString(1, pageId); if (lang != null) insertStatement.bindString(2, lang); if (timer.getInfo() != null) insertStatement.bindString(3, timer.getInfo()); if (timer.getInactive() != null) insertStatement.bindString(4, timer.getInactive()); if (timer.getFail() != null) insertStatement.bindString(5, timer.getFail()); return insertStatement.executeInsert(); // ContentValues cv = new ContentValues(); // // cv.put(PAGE_ID, pageId); // cv.put(PAGE_LANGUAGE, lang); // cv.put(TIMER_INFO, timer.getInfo()); // cv.put(TIMER_INACTIVE, timer.getInactive()); // cv.put(TIMER_FAIL, timer.getFail()); // // return db.insert(TABLE_PAGE_TIMER, null, cv); }