Class UserDetailsDAOText
java.lang.Object
dao.SpaceInvadersDAOText
dao.UserDetailsDAOText
-
Field Summary
Fields inherited from class dao.SpaceInvadersDAOText
SPACEINVADERS_SETTINGS_DB_NAME, SPACEINVADERS_USER_HIGH_SCORES_DB_NAME, SPACEINVADERS_USERS_DB_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<GameDetails> getHighScores(UserDetails user) Loads users high scores for all gamesstatic voidloadData(UserDetails userWanted) Loads user data into a user objectstatic voidsaveData(UserDetails userToBeSaved) Saves data of given objects to the database.Methods inherited from class dao.SpaceInvadersDAOText
connectToSpaceInvadersDatabase, getGameHighScores, getSettingsInputConnection, getUserHighScoresInputConnection, getUsersInputConnection, myDelete
-
Constructor Details
-
UserDetailsDAOText
public UserDetailsDAOText()
-
-
Method Details
-
loadData
Loads user data into a user object- Parameters:
userWanted- User details associated with the user will be loaded into this object- Throws:
FileNotFoundExceptionIOException
-
saveData
public static void saveData(UserDetails userToBeSaved) throws FileNotFoundException, IOException, ClassNotFoundException Saves data of given objects to the database. If user settings and/or game settings don't exist new data is inserted else existing data is updated SaveData does the saving using PreparedStatments.- Parameters:
userToBeSaved- UserDetails to save- Throws:
FileNotFoundExceptionClassNotFoundExceptionIOException
-
getHighScores
Loads users high scores for all games- Parameters:
user- The users details.- Returns:
- List of GameDetails objects containing the highscores for each type of game (combination of move speed and firing interval) that exists for this user in the database
- Throws:
SQLExceptionException
-