Interface IUserAnswerDAO
- All Known Implementing Classes:
UserAnswerDAO
public interface IUserAnswerDAO
Defines the interface for a UserAnswer DAO.
Any class implementing
IUserAnswerDAO
must provide implementations for
the CRUD methods in this interface.- Author:
- Joshua M.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
createUserAnswer
(UserAnswer userAnswer) Creates a new UserAnswer in the database.getAllUserQuestionAttempts
(int messageId, int questionNumber) Retrieves all attempts of UserAnswers for a specific question in a quiz.getAllUserQuizAnswers
(int messageId, int attempt) Retrieves all question UserAnswers for a specific attempt of a quiz.getAllUserQuizAttempts
(int messageId) Retrieves all attempts of question UserAnswers for a specific quiz.getUserQuestionAnswer
(int messageId, int attempt, int questionNumber) Retrieves a UserAnswer from the database
-
Method Details
-
createUserAnswer
Creates a new UserAnswer in the database.- Parameters:
userAnswer
- The UserAnswer to create.- Throws:
SQLException
- If an SQL error occurs during the operation.
-
getUserQuestionAnswer
UserAnswer getUserQuestionAnswer(int messageId, int attempt, int questionNumber) throws SQLException Retrieves a UserAnswer from the database- Parameters:
messageId
- The ID of the message associated with the UserAnswer.attempt
- The question attempt associated with the UserAnswer.questionNumber
- The question number associated with the UserAnswer.- Returns:
- The
UserAnswer
matching the implemented criteria. - Throws:
SQLException
- If an SQL error occurs during the operation.
-
getAllUserQuestionAttempts
Retrieves all attempts of UserAnswers for a specific question in a quiz.- Parameters:
messageId
- The ID of the message associated with the quiz.questionNumber
- The question number for which to retrieve answer options.- Returns:
- A list of
UserAnswer
objects for the specified question. - Throws:
SQLException
- If an SQL error occurs during the operation.
-
getAllUserQuizAnswers
Retrieves all question UserAnswers for a specific attempt of a quiz.- Parameters:
messageId
- The ID of the message associated with the quiz.attempt
- The attempt for which to retrieve answer options.- Returns:
- A list of
UserAnswer
objects for the specified question. - Throws:
SQLException
- If an SQL error occurs during the operation.
-
getAllUserQuizAttempts
Retrieves all attempts of question UserAnswers for a specific quiz.- Parameters:
messageId
- The ID of the message associated with the quiz.- Returns:
- A list of
UserAnswer
objects for the specified question. - Throws:
SQLException
- If an SQL error occurs during the operation.
-