O
- the type of result datapublic abstract class TopiaSQLQuery<O> extends Object
findSingleResult(TopiaContextImplementor)
or a multiple result with method findMultipleResult(TopiaContextImplementor)
.Constructor and Description |
---|
TopiaSQLQuery() |
Modifier and Type | Method and Description |
---|---|
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 long |
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.
|
protected abstract PreparedStatement prepareQuery(Connection connection) throws SQLException
connection
- jdbc connection to useSQLException
- if any problemprotected abstract O prepareResult(ResultSet set) throws SQLException
set
- the result setnull
SQLException
- if any probpublic O findSingleResult(TopiaContextImplementor tx) throws TopiaException
tx
- the transaction used to execute the query.null
if none found.TopiaException
- for any pbpublic List<O> findMultipleResult(TopiaContextImplementor tx) throws TopiaException
tx
- the transaction used to execute the query.TopiaException
- for any pbprotected void afterExecuteQuery(ResultSet set) throws SQLException
set
- the result set just obtainedSQLException
- if any probprotected void findSingleResult(List<O> result, ResultSet set) throws SQLException
result
- the result listset
- the set of the executed sql querySQLException
- if any pbprotected void findMultipleResult(List<O> result, ResultSet set) throws SQLException
result
- the result listset
- the set of the executed sql querySQLException
- if any pbprotected String[] getColumnNames(ResultSet set) throws SQLException
set
- the result set to inspectSQLException
- if any pbprotected long getNbRows(ResultSet set) throws SQLException
set
- the result set to inspectSQLException
- if any pbprotected Map<String,Object> getRowAsMap(String[] columnNames, ResultSet set) throws SQLException
columnNames
- column names of the result setset
- the set to inspectSQLException
- if any pbCopyright © 2004–2022 Code Lutin. All rights reserved.