|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectLectureGame.DataBase.DataBaseConnection
public class DataBaseConnection
Created by IntelliJ IDEA. User: olekrst Date: 26.jan.2007 Time: 12:06:26 This class connects to the SQL database. Its primary functionallity is to extract and register new users, and extracting different round and the questions associated with them.
Question
Field Summary | |
---|---|
private java.sql.PreparedStatement |
countQuestionsInRound
|
private java.sql.PreparedStatement |
getAllLectures
|
private java.sql.PreparedStatement |
getAllRoundsInLecture
|
private java.sql.PreparedStatement |
getGameMode
|
private java.sql.PreparedStatement |
getQuestion
|
private java.sql.PreparedStatement |
newUser
|
private java.sql.ResultSet |
rs
|
private java.sql.Statement |
stmt
|
Constructor Summary | |
---|---|
DataBaseConnection()
Creates a new database connection using com.mysql.jdbc.Driver |
Method Summary | |
---|---|
void |
addQuestion(Question question,
java.lang.String lectureId)
NOT IMPLEMENTED Method to be implemented when a Question editor is added |
java.lang.String |
getAllLectures()
Extracts all the existing Lectures from the database. |
int |
getGamgeMode(int roundID)
Returns the gamemode for a given round |
Question[] |
getQuestion(int roundID)
Extracts an array containing all the questions in a lecure |
int[] |
getRoundsInLecture(int lecture)
Extracts all the rounds in a given lecture. |
int |
getUser(java.lang.String usr,
java.lang.String password)
Method for checking username and password. |
int |
newUser(java.lang.String usr,
java.lang.String password)
Method for creating new users in the database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.sql.ResultSet rs
private java.sql.Statement stmt
private java.sql.PreparedStatement getQuestion
private java.sql.PreparedStatement newUser
private java.sql.PreparedStatement countQuestionsInRound
private java.sql.PreparedStatement getAllLectures
private java.sql.PreparedStatement getAllRoundsInLecture
private java.sql.PreparedStatement getGameMode
Constructor Detail |
---|
public DataBaseConnection()
Method Detail |
---|
public int getGamgeMode(int roundID)
roundID
- the rund to find the gamemode for
LG
public java.lang.String getAllLectures()
public void addQuestion(Question question, java.lang.String lectureId)
question
- the question to add to the databaselectureId
- the lectureID of the lecture which will contain the questionpublic int getUser(java.lang.String usr, java.lang.String password)
usr
- password
-
LG
public int newUser(java.lang.String usr, java.lang.String password)
usr
- the usernamepassword
- the password (cannot be "")
LG
public int[] getRoundsInLecture(int lecture)
lecture
-
public Question[] getQuestion(int roundID)
roundID
-
Question
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |