|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectonlineTests.LoadDataModel
This class stores actual data and privides methods for reading, adding, deleting and updating it into a relational database
User
,
Utils
,
DBConnections
Field Summary | |
protected java.sql.Connection |
con
Connection to HSQLDB DataBase |
protected static java.lang.String |
DEFAULT_URL
Represents url for HSQLDB DataBase connection |
protected static java.lang.String |
DRIVER
Represents driver for HSQLDB DataBase connection |
private java.lang.Integer |
lastID
ID of the last user added to DataBase |
protected java.lang.String |
SQLQuery
SQL Query |
protected java.util.Vector |
values
Holds actual data in this model |
Constructor Summary | |
LoadDataModel()
Constructs an empty LoadData model. |
Method Summary | |
boolean |
addRow(java.lang.String table,
java.util.Vector newValue)
Adds a row to the LoadData model. |
int |
addUser(java.lang.String name,
java.lang.String pass)
Adds record to Users table. |
boolean |
deleteRow(java.lang.String table,
int row)
Deletes specified row from the model. |
boolean |
deleteRow(java.lang.String table,
java.util.Vector rowToDelete)
Deletes specified row from the model. |
protected void |
freeConnection(java.sql.Connection con)
Returns a connection to the Connection Pool. |
java.util.Vector |
getColumns(java.lang.String table)
Gets column names for choosen table as a Vector |
java.lang.Integer |
getLastID()
Gets userID for the last added user in Users table. |
java.util.Vector |
getRow(int row)
Returns an entire row from the model as a Vector. |
int |
getRowCount()
Gets the row count of current data, stored in this model. |
java.util.Vector |
getValues()
Gets the vector which contains all the rows in the model. |
boolean |
loadData(java.lang.String sql)
Loads the model with actual data. |
boolean |
updateRow(java.lang.String table,
java.util.Vector oldValue,
java.util.Vector newValue)
Updates an entire row in the model with new values. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String DRIVER
protected static final java.lang.String DEFAULT_URL
protected java.sql.Connection con
protected java.util.Vector values
protected java.lang.String SQLQuery
private java.lang.Integer lastID
Constructor Detail |
public LoadDataModel()
Method Detail |
public java.util.Vector getValues()
protected void freeConnection(java.sql.Connection con)
con
- connection to be returned.public boolean loadData(java.lang.String sql) throws java.sql.SQLException
sql
- SQL Query to be executed
java.sql.SQLException
public int getRowCount()
public java.util.Vector getRow(int row)
row
- row number as int
public boolean addRow(java.lang.String table, java.util.Vector newValue) throws java.sql.SQLException
table
- table name for adding row tonewValue
- the row to be added az Vector
java.sql.SQLException
public java.util.Vector getColumns(java.lang.String table) throws java.sql.SQLException
table
- table name for getting column names from
java.sql.SQLException
public int addUser(java.lang.String name, java.lang.String pass)
name
- user namepass
- user password
public java.lang.Integer getLastID()
public boolean updateRow(java.lang.String table, java.util.Vector oldValue, java.util.Vector newValue) throws java.sql.SQLException
table
- the table to update row inoldValue
- the old rownewValue
- the new value ot the row
java.sql.SQLException
public boolean deleteRow(java.lang.String table, int row) throws java.sql.SQLException
table
- table to delete row fromrow
- nomber of row to be deleted
java.sql.SQLException
public boolean deleteRow(java.lang.String table, java.util.Vector rowToDelete) throws java.sql.SQLException
table
- table to delete row fromrowToDelete
- the row to be deleted from table as vector
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |