示例#1
0
  public boolean setUpvote(int v) {
    StatementHandle hndl;
    String query;

    if (vote == 0) {
      query = "INSERT INTO votes (upvote, uid, sid) VALUES (?, ?, ?)";
      hndl = insert_vote;
    } else {
      query = "UPDATE votes SET upvote = ? WHERE uid = ? AND sid = ?";
      hndl = set_vote;
    }

    ArrayList<Object> args = new ArrayList<Object>();
    args.add(new Integer(v));
    args.add(new Integer(uid));
    args.add(new Integer(sid));

    boolean ret;
    if (vote == 0) ret = DataAccess.createEntry(hndl, query, "id", args) > 0;
    else ret = DataAccess.update(hndl, query, args);
    if (ret) {
      vote = v;
      Solution s = Solution.getSolution(sid);
      s.setScore();
    }

    return ret;
  }
  public static long update(Application application) {
    ContentValues values = new ContentValues();
    values.put(Uid, application.getUid());
    values.put(AppName, application.getAppName());
    values.put(PackageName, application.getPackageName());
    values.put(Removed, application.getRemoved());

    DataAccess da = new DataAccess();
    return da.update(
        TableName, values, Id + " =? ", new String[] {String.valueOf(application.getId())});
  }
示例#3
0
  public static long update(SystemSetting setting) {
    ContentValues values = new ContentValues();

    values.put(Installed, setting.getInstalled() ? 1 : 0);
    values.put(RingingToneUri, setting.getRingingToneUri());
    values.put(AlarmRingingTone, setting.getAlarmRingingTone());
    values.put(VibrateInAlarms, setting.getVibrateInAlarms() ? 1 : 0);
    values.put(SoundInAlarms, setting.getSoundInAlarms() ? 1 : 0);

    DataAccess da = new DataAccess();
    return da.update(
        TableName, values, Id + " = ? ", new String[] {String.valueOf(setting.getId())});
  }