Interface IQuizDAO
- All Known Implementing Classes:
QuizDAO
public interface IQuizDAO
Defines the interface for a Quiz DAO.
Any class implementing
IQuizDAO
must provide implementations for
CRUD methods and other quiz-related operations in this interface.- Author:
- Joshua M.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
createQuiz
(Quiz quiz) Creates a new Quiz in the database.getAllChatQuizzes
(int chatId) Retrieves all Quizzes associated with a specific chat.getAllUserQuizzes
(int userId) Retrieves all Quizzes associated with a specific user.getQuiz
(int messageId) Retrieves a Quiz from the database by its associated message ID.
-
Method Details
-
createQuiz
Creates a new Quiz in the database.- Parameters:
quiz
- The Quiz to create.- Throws:
SQLException
- If an SQL error occurs during the operation.
-
getQuiz
Retrieves a Quiz from the database by its associated message ID.- Parameters:
messageId
- The ID of the message associated with the Quiz.- Returns:
- The
Quiz
matching the message ID, or null if not found. - Throws:
SQLException
- If an SQL error occurs during the operation.
-
getAllChatQuizzes
Retrieves all Quizzes associated with a specific chat.- Parameters:
chatId
- The ID of the chat whose quizzes are to be retrieved.- Returns:
- A list of
Quiz
objects associated with the chat. - Throws:
SQLException
- If an SQL error occurs during the operation.
-
getAllUserQuizzes
Retrieves all Quizzes associated with a specific user.- Parameters:
userId
- The ID of the user whose quizzes are to be retrieved.- Returns:
- A list of
Quiz
objects associated with the user. - Throws:
SQLException
- If an SQL error occurs during the operation.
-