|
Arch4J 1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.arch4j.dataaccess.DatabaseManager
This class is used to communicate with the data server. It's job is to execute SQL and invoke the processNextRow method on the listener.
ResultSetVisitor| Field Summary | |
protected org.arch4j.dataaccess.ConnectionManager |
connectionManager
|
protected static LoggingCategory |
loggingCategory
The logging category. |
| Constructor Summary | |
protected |
DatabaseManager()
Default constructor |
| Method Summary | |
protected Connection |
beginDatabaseAction()
Attempts to establish a connection to the database. |
protected PreparedStatement |
buildStatement(Connection connection,
String sql,
List parameters)
Creates a PreparedStatement object and populates it with the
given parameters. |
int |
delete(String sql,
List parameters)
Executes a SQL DELETE statement containing zero or more question-marked parameters and returns the number of rows affected. |
protected void |
endDatabaseAction(ResultSet jdbcResultSet,
Statement statement,
Connection aConnection)
Releases the JDBC resources. |
int |
execUpdate(String sql,
List parameters)
Executes a SQL DELETE statement containing zero or more question-marked parameters and returns the number of rows affected. |
void |
execUpdate(String sql,
List parameters,
ResultSetVisitor aListener)
Executes a SQL INSERT, UPDATE or DELETE statement containing zero or more question-marked parameters and returns the number of rows affected. |
void |
execute(Query query,
ResultSetVisitor aListener)
This method executes a query that could be SELECT, INSERT, DELETE or UPDATE |
void |
execute(String sql,
List parameters,
ResultSetVisitor aListener)
Executes a SQL SELECT, INSERT, UPDATE, or DELETE statement containing zero or more question-marked parameters. |
void |
execute(String sql,
ResultSetVisitor aListener)
Executes a SQL SELECT, INSERT, UPDATE, or DELETE statement containing no parameters. |
void |
execute(String domain,
String propertyName,
List parameters,
ResultSetVisitor aListener)
Executes a SQL SELECT, INSERT, UPDATE, or DELETE statement specified by the given property name in the given property domain. |
void |
execute(String domain,
String propertyName,
ResultSetVisitor aListener)
Executes a SQL SELECT, INSERT, UPDATE, or DELETE statement specified by the given property name in the given property domain. |
BatchResult |
executeBatch(BatchQuery batchQuery)
Note that the JDBC specification does not specify if a BatchQuery will execute as an atomic operation or not. |
int |
insert(String sql,
List parameters)
Executes a SQL INSERT statement containing zero or more question-marked parameters and returns the number of rows affected. |
protected void |
notifyListener(ResultSet jdbcResultSet,
ResultSetVisitor aListener)
Loop through the result set notifying the listener as each row is processed. |
void |
select(String sql,
List parameters,
ResultSetVisitor aListener)
Executes a SQL SELECT query containing no parameters. |
void |
select(String sql,
ResultSetVisitor aListener)
Executes a SQL SELECT query containing no parameters. |
int |
update(String sql,
List parameters)
Executes a SQL UPDATE statement containing zero or more question-marked parameters and returns the number of rows affected. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static LoggingCategory loggingCategory
protected org.arch4j.dataaccess.ConnectionManager connectionManager
| Constructor Detail |
protected DatabaseManager()
| Method Detail |
public void execute(Query query,
ResultSetVisitor aListener)
throws DataAccessException
query - A query Object that has both the SQL and the values filled inaListener - The call back listener that needs to be called
DataAccessException
public void execute(String domain,
String propertyName,
List parameters,
ResultSetVisitor aListener)
throws SQLException
domain - The property file to use.propertyName - The property whose value is a SQL statement.parameters - The parameters to substitute for question marks.aListener - An object that will process the result set.
SQLException - If a database error occurs.
public void execute(String domain,
String propertyName,
ResultSetVisitor aListener)
throws SQLException
domain - The property file to use.propertyName - The property whose value is a SQL statement.aListener - An object that will process the result set.
SQLException - If a database error occurs.
public void execute(String sql,
List parameters,
ResultSetVisitor aListener)
throws SQLException
sql - The SQL statement to execute.parameters - The parameters to substitute for question marks.aListener - An object that will process the result set.
SQLException - If a database error occurs.
public void execute(String sql,
ResultSetVisitor aListener)
throws SQLException
sql - The SQL statement to execute.aListener - An object that will process the result set.
SQLException - If a database error occurs.
public void select(String sql,
ResultSetVisitor aListener)
throws SQLException
sql - The SQL SELECT statement to execute.aListener - An object that will process the result set.
SQLException - If a database error occurs.
public void select(String sql,
List parameters,
ResultSetVisitor aListener)
throws SQLException
sql - The SQL SELECT statement to execute.aListener - An object that will process the result set.
SQLException - If a database error occurs.
public int insert(String sql,
List parameters)
throws SQLException
sql - The SQL INSERT statement to execute.parameters - The parameters to substitute for question marks.
SQLException - If a database error occurs.
public int update(String sql,
List parameters)
throws SQLException
sql - The SQL UPDATE statement to execute.parameters - The parameters to substitute for question marks.
SQLException - If a database error occurs.
public int delete(String sql,
List parameters)
throws SQLException
sql - The SQL DELETE statement to execute.parameters - The parameters to substitute for question marks.
SQLException - If a database error occurs.
public int execUpdate(String sql,
List parameters)
throws SQLException
sql - The SQL DELETE statement to execute.parameters - The parameters to substitute for question marks.
SQLException - If a database error occurs.
public void execUpdate(String sql,
List parameters,
ResultSetVisitor aListener)
throws SQLException
sql - The SQL statement to execute.parameters - The parameters to substitute for question marks.aListener - An object that will process the result set.
SQLException - If a database error occurs.
protected PreparedStatement buildStatement(Connection connection,
String sql,
List parameters)
throws SQLException
PreparedStatement object and populates it with the
given parameters.
connection - The database connection.sql - The SQL statement to start with.parameters - The parameters to substitute for question marks.
PreparedStatement object containing the
pre-compiled statement
SQLException - If a database error occurs.
protected void notifyListener(ResultSet jdbcResultSet,
ResultSetVisitor aListener)
throws SQLException
jdbcResultSet - The data produced by a query.aListener - An object that will process the result set.
SQLException - If a database error occurs.
public BatchResult executeBatch(BatchQuery batchQuery)
throws DataAccessException
DataAccessException - If a database error occurs.
protected Connection beginDatabaseAction()
throws SQLException
SQLException - If unable to connect or no more connections
available.
protected void endDatabaseAction(ResultSet jdbcResultSet,
Statement statement,
Connection aConnection)
jdbcResultSet - The data produced by a query.statement - The pre-compiled SQL statement.
|
Arch4J 1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||