|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.problets.lib.comm.database.Database
public class Database
Upper class used to connect to database
Field Summary | |
---|---|
static java.lang.String |
DATABASE_NAME
|
static java.lang.String |
DATABASE_TRANSLATION_FILE
|
Constructor Summary | |
---|---|
Database(java.lang.String databaseName)
Constructor for the upper-level database class. |
Method Summary | |
---|---|
void |
create(java.lang.String databaseName)
Create a new database |
void |
create(java.lang.String tableName,
java.util.Vector structure)
Create a new table |
void |
delete(java.lang.String tableName,
DatabaseRecord conditions)
Delete data from the specified table |
void |
disconnectDatabase()
A function to disocnnect from the database ( just a call to CommunicateDatabase disconnect) |
void |
drop(java.lang.String tableName)
Drop a table from the current database |
java.util.Vector |
getFields(java.lang.String tableName)
Get the names of each field in the specified table |
java.util.Vector |
getTables()
get the table names in the current database |
void |
insert(java.util.HashMap translationTable)
Update the database with what is in the translation table |
static void |
main(java.lang.String[] args)
|
java.sql.ResultSet |
select(java.lang.String tableName)
Select all data from a specified table |
java.sql.ResultSet |
select(java.lang.String tableName,
DatabaseRecord fields,
DatabaseRecord conditions,
java.lang.String operator)
Query the database |
void |
update(java.lang.String tableName,
DatabaseRecord newValues,
DatabaseRecord conditions)
Update selected fields in the database |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DATABASE_NAME
public static final java.lang.String DATABASE_TRANSLATION_FILE
Constructor Detail |
---|
public Database(java.lang.String databaseName)
databaseName
- the name of the database to be used
for communicatingMethod Detail |
---|
public java.sql.ResultSet select(java.lang.String tableName)
tableName
- the name of the table to be used
public java.sql.ResultSet select(java.lang.String tableName, DatabaseRecord fields, DatabaseRecord conditions, java.lang.String operator)
tableName
- the table name to be usedfields
- the fields that have to be selectedconditions
- a database record of the conditions
for selecting what to be displayedoperator
- what operator should be used for the
specified conditions
public java.util.Vector getTables()
public java.util.Vector getFields(java.lang.String tableName)
tableName
- the table to be used
public void create(java.lang.String databaseName)
databaseName
- the name of the new database that will be
createdpublic void create(java.lang.String tableName, java.util.Vector structure)
tableName
- the name of the table to be insertedstructure
- a vector holding the data about each field in the new tablepublic void drop(java.lang.String tableName)
tableName
- the table to be droppedpublic void delete(java.lang.String tableName, DatabaseRecord conditions)
tableName
- the table from which entries will be deletedconditions
- the conditions to be used for the deletion of certain
itemspublic void insert(java.util.HashMap translationTable)
translationTable
- a hash map that contains the
translation done by the DataTranslatorpublic void update(java.lang.String tableName, DatabaseRecord newValues, DatabaseRecord conditions)
tableName
- the table to be usednewValues
- a database record holding the new AttributeValue pairs to change
the databaseconditions
- a database record holding the conditions to be used
for updating certain fieldspublic void disconnectDatabase()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |