|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DatabaseAccess
An interface to access relational databases
| Method Summary | ||
|---|---|---|
|
accumulate(String sql,
ResultSetHandler<T> handler)
Accumulate the query result within the ResultSetHandler, then return the result from the handler |
|
void |
dispose()
Close all connections managed by this database access |
|
Relation |
getRelation(String tableName)
Gets the relation (schema) information of the table. |
|
List<String> |
getTableNameList()
Gets the table names contained in this database. |
|
|
insert(String tableName,
T bean)
Inserts a bean into a table |
|
|
query(String sql,
BeanResultHandler<T> beanResultHandler)
Performs an SQL query, while consuming the results with the given handler |
|
|
query(String sql,
Class<T> resultRowType)
perform the given SQL query, then output its results |
|
|
query(String sql,
ResultSetHandler<T> resultSetHandler)
Performs an SQL query, while consuming the results with the given handler |
|
void |
setAutoCommit(boolean enableAutoCommit)
Enable/disable auto commit mode for all subsequent queries. |
|
void |
setQueryTimeout(int sec)
Sets the time of the query until it will be terminated in seconds |
|
|
singleColumnQuery(String sql,
String targetColumn,
Class<T> resultColumnType)
Retrieves only the single column from the SQL query result |
|
|
toJSON(String sql,
Class<T> beanClass,
Writer writer)
|
|
int |
update(String sql)
Performs the update query |
|
int |
update(String sql,
boolean autoCommit)
Performs the update query |
|
int |
updateWithPreparedStatement(String sqlForPreparedStatement,
PreparedStatementHandler handler)
Performs the update using prepared statement. |
|
| Method Detail |
|---|
List<String> getTableNameList()
throws DBException
DBException
Relation getRelation(String tableName)
throws DBException
tableName - the target table name
DBException
<T> List<T> query(String sql,
Class<T> resultRowType)
throws DBException
T - row type : Bean class type to which the result will be
transformedsql - An SQL statementresultRowType - Bean class type to which the result will be transformedresult - the list of the result beans
DBException
<T> void query(String sql,
ResultSetHandler<T> resultSetHandler)
throws DBException
T - sql - the SQL query expressionresultSetHandler - the result set handler that consumes the result set of the
query.
DBException
<T> void query(String sql,
BeanResultHandler<T> beanResultHandler)
throws DBException
T - sql - beanResultHandler -
DBException
<T> void toJSON(String sql,
Class<T> beanClass,
Writer writer)
throws DBException,
IOException
T - sql - beanClass - writer -
DBException
IOException
<T> List<T> singleColumnQuery(String sql,
String targetColumn,
Class<T> resultColumnType)
throws DBException
T - sql - targetColumn - the target columnresultColumnType - the target column type to be transformed
DBException
<T> T accumulate(String sql,
ResultSetHandler<T> handler)
throws DBException
T - sql - handler -
DBException
int update(String sql)
throws DBException
sql - the update SQL query
DBException
int update(String sql,
boolean autoCommit)
throws DBException
sql - the update SQL queryautoCommit - true when enable auto commit arounc this update query, false
otherwise
DBException
int updateWithPreparedStatement(String sqlForPreparedStatement,
PreparedStatementHandler handler)
throws DBException
PreparedStatementHandler via
PreparedStatement.setBytes(int, byte[]), etc.
sqlForPreparedStatement - the update SQL statement that may contain '?' mark that will
be filled in the PreparedStatementHandlerhandler - the handler for filling '?' marks in the sql statement
DBException
<T> int insert(String tableName,
T bean)
throws DBException
T - tableName - bean -
DBExceptionvoid setQueryTimeout(int sec)
sec - timeout (sec.)void setAutoCommit(boolean enableAutoCommit)
void dispose()
throws DBException
DBException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
