|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.stratelia.webactiv.util.AbstractTable<T>
public abstract class AbstractTable<T>
A Table object manages a table in a database.
Field Summary | |
---|---|
protected Schema |
schema
|
Constructor Summary | |
---|---|
AbstractTable(Schema schema,
String tableName)
|
Method Summary | |
---|---|
static String |
aliasColumns(String rowAlias,
String columnList)
Builds an aliased columns list from a row alias and a columns list. |
protected abstract T |
fetchRow(ResultSet rs)
Builds a new row object which values are retrieved from the given ResultSet. |
protected Integer |
getInteger(ResultSet rs)
|
protected Integer |
getInteger(String query,
int[] ids)
Returns the integer of the single row, single column resultset returned by the given query with id parameters. |
protected List<T> |
getMatchingRows(String returnedColumns,
String[] matchColumns,
String[] matchValues)
Returns the rows like a sample row. |
int |
getNextId()
Returns the next id which can be used to create a new row. |
protected ArrayList<T> |
getRows(ResultSet rs)
|
protected List<T> |
getRows(String query)
Returns the rows described by the given no parameters query. |
protected List<T> |
getRows(String query,
int id)
Returns the rows described by the given query with one id parameter. |
protected List<T> |
getRows(String query,
int[] ids)
Returns the rows described by the given query with id parameters. |
protected List<T> |
getRows(String query,
int[] ids,
String[] params)
Returns the rows described by the given query with id and String parameters. |
protected List<T> |
getRows(String query,
String parameter)
Returns the rows described by the given query with one string parameter. |
protected List<T> |
getRows(String query,
String[] params)
Returns the rows described by the given query and String parameters. |
protected T |
getUniqueRow(ResultSet rs)
|
protected T |
getUniqueRow(String query)
Returns the unique row referenced by the given query with no parameters. |
protected T |
getUniqueRow(String query,
int id)
Returns the unique row referenced by the given query and id. |
protected T |
getUniqueRow(String query,
int[] ids)
Returns the unique row referenced by the given query and int[] ids. |
protected T |
getUniqueRow(String query,
int[] ids,
String[] params)
Returns the unique row referenced by the given query, int[] ids and String[] params. |
protected T |
getUniqueRow(String query,
String parameter)
Returns the unique row referenced by the given query and String parameter. |
protected T |
getUniqueRow(String query,
String[] params)
Returns the unique row referenced by the given query and String[] params. |
protected int |
insertRow(String insertQuery,
T row)
|
protected abstract void |
prepareInsert(String insertQuery,
PreparedStatement insert,
T row)
Set all the parameters of the insert PreparedStatement built from the insertQuery in order to insert the given row. |
protected abstract void |
prepareUpdate(String updateQuery,
PreparedStatement update,
T row)
Set all the parameters of the update PreparedStatement built from the updateQuery in order to update the given row. |
static String |
truncate(String value,
int maxSize)
Truncates a string value to be inserted in a fixed size column |
protected int |
updateRelation(String query,
int param)
|
protected int |
updateRelation(String query,
int[] param)
|
protected int |
updateRow(String updateQuery,
T row)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Schema schema
Constructor Detail |
---|
public AbstractTable(Schema schema, String tableName)
Method Detail |
---|
public static String aliasColumns(String rowAlias, String columnList)
public static String truncate(String value, int maxSize)
public int getNextId() throws SQLException
SQLException
protected abstract T fetchRow(ResultSet rs) throws SQLException
SQLException
protected abstract void prepareInsert(String insertQuery, PreparedStatement insert, T row) throws SQLException
SQLException
protected abstract void prepareUpdate(String updateQuery, PreparedStatement update, T row) throws SQLException
SQLException
protected T getUniqueRow(String query, int id) throws UtilException
query
- the sql query string must be like "select * from ... where ... id=?" where id is
an int column.id
- references an unique row.
UtilException
protected T getUniqueRow(String query, String parameter) throws UtilException
query
- the sql query string must be like "select * from ... where ... col=?" where col is
a text column.parameter
- references an unique row.
UtilException
protected T getUniqueRow(String query, int[] ids) throws UtilException
query
- the sql query string must be like "select * from ... where ... col1=? ... coln=?"
where the col are int columns.ids
- references an unique row.
UtilException
protected T getUniqueRow(String query, String[] params) throws UtilException
query
- the sql query string must be like "select * from ... where ... col1=? ... coln=?"
where the col are int columns.params
- references an unique row.
UtilException
protected T getUniqueRow(String query, int[] ids, String[] params) throws UtilException
query
- the sql query string must be like "select * from ... where ... col1=? ... coln=?"
where the col are int columns.ids
- references an unique row.params
- references an unique row.
UtilException
protected T getUniqueRow(String query) throws UtilException
query
- the sql query string must be like "select * from ... where ..."
UtilException
protected List<T> getRows(String query) throws UtilException
UtilException
protected List<T> getRows(String query, int id) throws UtilException
UtilException
protected List<T> getRows(String query, String parameter) throws UtilException
UtilException
protected List<T> getRows(String query, int[] ids) throws UtilException
UtilException
protected List<T> getRows(String query, String[] params) throws UtilException
UtilException
protected List<T> getRows(String query, int[] ids, String[] params) throws UtilException
UtilException
protected List<T> getMatchingRows(String returnedColumns, String[] matchColumns, String[] matchValues) throws UtilException
UtilException
protected Integer getInteger(String query, int[] ids) throws UtilException
UtilException
protected T getUniqueRow(ResultSet rs) throws SQLException, UtilException
SQLException
UtilException
protected ArrayList<T> getRows(ResultSet rs) throws SQLException
SQLException
protected Integer getInteger(ResultSet rs) throws SQLException, UtilException
SQLException
UtilException
protected int insertRow(String insertQuery, T row) throws UtilException
UtilException
protected int updateRow(String updateQuery, T row) throws UtilException
UtilException
protected int updateRelation(String query, int param) throws UtilException
UtilException
protected int updateRelation(String query, int[] param) throws UtilException
UtilException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |