|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlecturequiz.server.main.MySQLDB
public class MySQLDB
Implements a DB backend to MySQL
Constructor Summary | |
---|---|
MySQLDB()
Private singleton constructor |
Method Summary | |
---|---|
User |
authenticateUser(java.lang.String username,
java.lang.String password)
Tries to authenticate a user against the database. |
FullQuestionInfo |
getQuestion(int id)
Returns all information on the question with the supplied id |
java.util.List<FullQuestionInfo> |
getQuestionList()
Returns a list of all available questions. |
Quiz |
getQuiz(int id)
Returns the quiz with the given ID from the database |
java.util.ArrayList<QuizInfo> |
getQuizList()
Returns a list of all available quizzes |
User |
getUser(int id)
Returns a user from the database with the supplied ID. |
int |
saveQuiz(FullQuizInfo fqi,
User user)
Saves a quiz to the database |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MySQLDB()
Method Detail |
---|
public java.util.ArrayList<QuizInfo> getQuizList()
getQuizList
in interface DBInterface
public User authenticateUser(java.lang.String username, java.lang.String password)
authenticateUser
in interface DBInterface
username
- Username sent to the database.password
- Password sent to the database.
public User getUser(int id)
getUser
in interface DBInterface
id
- ID of the user to retrieve
public Quiz getQuiz(int id)
getQuiz
in interface DBInterface
id
- ID of the quiz
public java.util.List<FullQuestionInfo> getQuestionList()
getQuestionList
in interface DBInterface
public FullQuestionInfo getQuestion(int id)
getQuestion
in interface DBInterface
id
- ID of the question to retrieve
public int saveQuiz(FullQuizInfo fqi, User user)
saveQuiz
in interface DBInterface
fqi
- All information of the quiz to be saved. If the ID of a quiz is 0
the quiz will be created. If any questions have the ID 0 they will be created and
answers of this question should be give ID's of 0-n and correctAnswer should point
to one of these IDs.user
- The user trying to save the quiz. If this is not done by a logged in user
this can be null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |