コード例 #1
0
ファイル: DatabaseProfile.java プロジェクト: Nerogar/ocs5
  public boolean loadUserStatistics(Profile profile) {
    PreparedStatement ps = null;

    try {

      ps =
          database
              .getConnection()
              .prepareStatement(
                  "SELECT wcaID, forumID  FROM " + prefix + "user WHERE id=? LIMIT 1;");

      ps.setInt(1, profile.getUser().getID());
      ResultSet result = ps.executeQuery();

      if (!result.next()) return false;

      profile.wcaID = result.getString("wcaID");
      profile.forumID = result.getInt("forumID");

    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
      closeOrFail(ps);
    }

    return true;
  }