|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.topia.framework.TopiaSQLQuery<O>
O - the type of result datapublic abstract class TopiaSQLQuery<O>
An executor of sql query which permits to obtain a single result via
the method findSingleResult(TopiaContextImplementor)
or a multiple result with method findMultipleResult(TopiaContextImplementor).
| Constructor Summary | |
|---|---|
TopiaSQLQuery()
|
|
| Method Summary | |
|---|---|
protected void |
afterExecuteQuery(ResultSet set)
A hook to obtain the result set just after the query execute. |
protected void |
findMultipleResult(List<O> result,
ResultSet set)
Obtain a multi result given the result set and push in in the result list. |
List<O> |
findMultipleResult(TopiaContextImplementor tx)
Obtain a multiple results fro the builded sql query. |
protected void |
findSingleResult(List<O> result,
ResultSet set)
Obtain a single result given the result set and push in in the result list. |
O |
findSingleResult(TopiaContextImplementor tx)
Obtain a single result from the builded sql query. |
protected String[] |
getColumnNames(ResultSet set)
Obtain the column names of a given result set using his metadata. |
protected int |
getNbRows(ResultSet set)
From a given result set, let's count his number of row. |
protected Map<String,Object> |
getRowAsMap(String[] columnNames,
ResultSet set)
Given the column names of the result set, transform the row of the result set to a map with column name as key. |
protected abstract PreparedStatement |
prepareQuery(Connection connection)
Prepare the statement used to do the sql query. |
protected abstract O |
prepareResult(ResultSet set)
given a result set, extract the data. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TopiaSQLQuery()
| Method Detail |
|---|
protected abstract PreparedStatement prepareQuery(Connection connection)
throws SQLException
connection - jdbc connection to use
SQLException - if any problem
protected abstract O prepareResult(ResultSet set)
throws SQLException
set - the result set
null
SQLException - if any prob
public O findSingleResult(TopiaContextImplementor tx)
throws TopiaException
tx - the transaction used to execute the query.
null if none found.
TopiaException - for any pb
public List<O> findMultipleResult(TopiaContextImplementor tx)
throws TopiaException
tx - the transaction used to execute the query.
TopiaException - for any pb
protected void afterExecuteQuery(ResultSet set)
throws SQLException
set - the result set just obtained
SQLException - if any prob
protected void findSingleResult(List<O> result,
ResultSet set)
throws SQLException
result - the result listset - the set of the executed sql query
SQLException - if any pb
protected void findMultipleResult(List<O> result,
ResultSet set)
throws SQLException
result - the result listset - the set of the executed sql query
SQLException - if any pb
protected String[] getColumnNames(ResultSet set)
throws SQLException
set - the result set to inspect
SQLException - if any pb
protected int getNbRows(ResultSet set)
throws SQLException
set - the result set to inspect
SQLException - if any pb
protected Map<String,Object> getRowAsMap(String[] columnNames,
ResultSet set)
throws SQLException
columnNames - column names of the result setset - the set to inspect
SQLException - if any pb
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||