|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscheduler.db.SQLDB
public class SQLDB
This class provides for direct access to a MySQL database. Though it a user can connect to a database, get different tables related to the scheduler, and insert SQL statements to be run in the database.
Field Summary | |
---|---|
private java.sql.Connection |
conn
The connection |
private CourseDB |
courseDB
The course database. |
private InstructorDB |
instructorDB
The instructor database. |
private LocationDB |
locationDB
The location databse. |
private PreferencesDB |
preferencesDB
The preferences database |
Constructor Summary | |
---|---|
SQLDB()
This constructor will create the SQLDB object. |
Method Summary | |
---|---|
void |
close()
The close() method closes a connection to the database. |
CourseDB |
getCourseDB()
Returns the course database. |
InstructorDB |
getInstructorDB()
Returns the instructor database. |
Course |
getLab(java.util.ArrayList<Course> arrList,
int lab)
Returns the instructor database. |
LocationDB |
getLocationDB()
Returns the location database. |
PreferencesDB |
getPreferencesDB()
Returns the preferences database. |
void |
insertPrefStmt(java.lang.String table,
java.lang.String val)
The insertPrefStmt runs a SQL insert command. |
void |
insertStmt(java.lang.String table,
java.lang.String val)
The insertStmt runs a SQL insert command. |
void |
open()
The open() method opens a connection to the database. |
void |
open(java.lang.String url)
This open() method will connect to a given database. |
void |
removePrefStmt(java.lang.String table,
java.lang.String whereClause)
The removePrefStmt method runs an SQL delete command on the preferences table. |
void |
removeStmt(java.lang.String table,
java.lang.String whereClause)
The removeStmt method runs an SQL delete command. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private InstructorDB instructorDB
private CourseDB courseDB
private LocationDB locationDB
private PreferencesDB preferencesDB
private java.sql.Connection conn
Constructor Detail |
---|
public SQLDB()
Method Detail |
---|
public LocationDB getLocationDB()
public InstructorDB getInstructorDB()
public Course getLab(java.util.ArrayList<Course> arrList, int lab)
arrList
- An arraylist of courseslab
- An integer representing a lab's id
public CourseDB getCourseDB()
public PreferencesDB getPreferencesDB()
// ** Pre and Post conditions ** // Pre: // SQL conn must not be Null conn != nil Post: // PreferencesDB can not be Null pdb != nil
public void open()
public void open(java.lang.String url)
url
- mysql url given in the format such as "mysql://cedders.homelinux.net/jseall".public void close()
public void insertStmt(java.lang.String table, java.lang.String val)
table
- A string representing the table that data will be added to.val
- A string representing the data to add.public void insertPrefStmt(java.lang.String table, java.lang.String val)
table
- A string representing the table that data will be added toval
- A string representing the data to add.
// ** Pre and Post conditions ** // Pre: // table can not be Null table != nil && // val can not be Null val != nil Post: // Preference is added to SQLDB table.contains(val)
public void removePrefStmt(java.lang.String table, java.lang.String whereClause)
table
- A string representing the table that data will be removedwhereClause
- A string representing the data to remove.public void removeStmt(java.lang.String table, java.lang.String whereClause)
table
- A string representing the table that data will be removed.whereClause
- A string representing the data to remove.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |