Package persistence

Class DBRecord

java.lang.Object
persistence.DBRecord

public final class DBRecord extends Object
Implementation of DBRecord class for Database INSERT and SELECT queries.
  • Constructor Details

    • DBRecord

      public DBRecord(String p1Name, String p2Name, int winner, int time)
      Constructs a new record from String and int parameters.
      Parameters:
      p1Name - name of Player1
      p2Name - name of Player2
      winner - the winner's number
      time - the game's length in seconds
    • DBRecord

      public DBRecord(ResultSet resultSet)
      Constructs a new record from a ResultSet.
      Parameters:
      resultSet - the ResultSet to convert
  • Method Details

    • getP1Name

      public String getP1Name()
      Returns the name of Player1.
      Returns:
      the name of Player1
    • getP2Name

      public String getP2Name()
      Returns the name of Player2.
      Returns:
      the name of Player2
    • getWinner

      public int getWinner()
      Returns the winner's number or 0 for draw.
      Returns:
      the winner's number or 0 for draw
    • getTime

      public int getTime()
      Returns the game's length in seconds.
      Returns:
      the game's length in seconds
    • toString

      public String toString()
      Returns the inner state of the record as a String.
      Overrides:
      toString in class Object
      Returns:
      the inner state of the record as a String