Пример #1
0
 public void deleteFav(MainPageItem qy) {
   Cursor cursor = null;
   String where =
       FavTable.USER_ID
           + " = '"
           + MyApplication.getInstance().getCurrentUser().getObjectId()
           + "' AND "
           + FavTable.OBJECT_ID
           + " = '"
           + qy.getObjectId()
           + "'";
   cursor = dbHelper.query(DBHelper.TABLE_NAME, null, where, null, null, null, null);
   if (cursor != null && cursor.getCount() > 0) {
     cursor.moveToFirst();
     int isLove = cursor.getInt(cursor.getColumnIndex(FavTable.IS_LOVE));
     if (isLove == 0) {
       dbHelper.delete(DBHelper.TABLE_NAME, where, null);
     } else {
       ContentValues cv = new ContentValues();
       cv.put(FavTable.IS_FAV, 0);
       dbHelper.update(DBHelper.TABLE_NAME, cv, where, null);
     }
   }
   if (cursor != null) {
     cursor.close();
     dbHelper.close();
   }
 }
Пример #2
0
 public boolean delData(int ID) {
   StringBuilder bd = new StringBuilder();
   bd.append(GtdTable.SMS_ID).append(" = ?");
   return helper.delete(GtdTable.TABLE_NAME, bd.toString(), new String[] {String.valueOf(ID)});
 }