public boolean updateResult(Result result) {
    Log.d(TAG, "updateResult()");
    open();
    try {
      ContentValues args = new ContentValues();

      args.put(COLUMN_HOLE_NUMBER, result.getHoleNumber());
      args.put(COLUMN_PAR_NUMBER, result.getParNumber());
      args.put(COLUMN_PLAYER_1_SCORE, result.getOriginalScore(0));
      args.put(COLUMN_PLAYER_2_SCORE, result.getOriginalScore(1));
      args.put(COLUMN_PLAYER_3_SCORE, result.getOriginalScore(2));
      args.put(COLUMN_PLAYER_4_SCORE, result.getOriginalScore(3));
      args.put(COLUMN_PLAYER_5_SCORE, result.getOriginalScore(4));
      args.put(COLUMN_PLAYER_6_SCORE, result.getOriginalScore(5));
      args.put(COLUMN_PLAYER_1_HANDICAP_USED, result.getUsedHandicap(0));
      args.put(COLUMN_PLAYER_2_HANDICAP_USED, result.getUsedHandicap(1));
      args.put(COLUMN_PLAYER_3_HANDICAP_USED, result.getUsedHandicap(2));
      args.put(COLUMN_PLAYER_4_HANDICAP_USED, result.getUsedHandicap(3));
      args.put(COLUMN_PLAYER_5_HANDICAP_USED, result.getUsedHandicap(4));
      args.put(COLUMN_PLAYER_6_HANDICAP_USED, result.getUsedHandicap(5));

      long dbResult = mDb.replace(TABLE, null, args);
      return (dbResult >= 0L);
    } finally {
      close();
    }
  }
  public Result getResult(int holeNumber) {
    Log.d(TAG, "getResult(" + holeNumber + ")");
    open();
    Cursor cursor = null;
    try {
      cursor =
          mDb.query(
              TABLE,
              new String[] {
                COLUMN_HOLE_NUMBER,
                COLUMN_PAR_NUMBER,
                COLUMN_PLAYER_1_SCORE,
                COLUMN_PLAYER_2_SCORE,
                COLUMN_PLAYER_3_SCORE,
                COLUMN_PLAYER_4_SCORE,
                COLUMN_PLAYER_5_SCORE,
                COLUMN_PLAYER_6_SCORE,
                COLUMN_PLAYER_1_HANDICAP_USED,
                COLUMN_PLAYER_2_HANDICAP_USED,
                COLUMN_PLAYER_3_HANDICAP_USED,
                COLUMN_PLAYER_4_HANDICAP_USED,
                COLUMN_PLAYER_5_HANDICAP_USED,
                COLUMN_PLAYER_6_HANDICAP_USED
              },
              COLUMN_HOLE_NUMBER + "=? ",
              new String[] {String.valueOf(holeNumber)},
              null,
              null,
              null);

      if (cursor != null) cursor.moveToFirst();

      Result result = null;
      if (!cursor.isAfterLast()) {
        int offset = 0;

        holeNumber = cursor.getInt(offset++);
        int parNumber = cursor.getInt(offset++);
        int player1Score = cursor.getInt(offset++);
        int player2Score = cursor.getInt(offset++);
        int player3Score = cursor.getInt(offset++);
        int player4Score = cursor.getInt(offset++);
        int player5Score = cursor.getInt(offset++);
        int player6Score = cursor.getInt(offset++);
        int player1HandicapUsed = cursor.getInt(offset++);
        int player2HandicapUsed = cursor.getInt(offset++);
        int player3HandicapUsed = cursor.getInt(offset++);
        int player4HandicapUsed = cursor.getInt(offset++);
        int player5HandicapUsed = cursor.getInt(offset++);
        int player6HandicapUsed = cursor.getInt(offset++);

        result = new Result(holeNumber, parNumber);
        result.setScore(0, player1Score);
        result.setScore(1, player2Score);
        result.setScore(2, player3Score);
        result.setScore(3, player4Score);
        result.setScore(4, player5Score);
        result.setScore(5, player6Score);
        result.setUsedHandicap(0, player1HandicapUsed);
        result.setUsedHandicap(1, player2HandicapUsed);
        result.setUsedHandicap(2, player3HandicapUsed);
        result.setUsedHandicap(3, player4HandicapUsed);
        result.setUsedHandicap(4, player5HandicapUsed);
        result.setUsedHandicap(5, player6HandicapUsed);
        result.calculate();

        cursor.moveToNext();
      }

      return result;
    } finally {
      if (cursor != null) {
        cursor.close();
      }
      close();
    }
  }