|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wamblee.support.persistence.DatabaseUtils
public class DatabaseUtils
Database utilities is a simple support class for common tasks in working with databases.
| Nested Class Summary | |
|---|---|
static interface |
DatabaseUtils.JdbcUnitOfWork<T>
|
static interface |
DatabaseUtils.TableSet
|
static interface |
DatabaseUtils.TableSetOperation
|
| Constructor Summary | |
|---|---|
DatabaseUtils(javax.sql.DataSource aDataSource,
org.dbunit.dataset.filter.ITableFilterSimple aTables)
Constructs the database utils. |
|
| Method Summary | ||
|---|---|---|
void |
cleanDatabase()
|
|
void |
cleanDatabase(org.dbunit.dataset.filter.ITableFilterSimple aSelection)
|
|
int |
countResultSet(java.sql.ResultSet aResultSet)
|
|
org.dbunit.IDatabaseTester |
createDbTester()
|
|
org.dbunit.IDatabaseTester |
createDbTester(java.lang.String[] aTables)
|
|
void |
dropTable(java.lang.String aTable)
|
|
void |
dropTables()
|
|
void |
dropTables(org.dbunit.dataset.filter.ITableFilterSimple aTables)
|
|
void |
emptyTable(java.lang.String aTable)
|
|
void |
emptyTables()
|
|
void |
emptyTables(org.dbunit.dataset.filter.ITableFilterSimple aSelection)
|
|
|
executeInTransaction(DatabaseUtils.JdbcUnitOfWork<T> aCallback)
|
|
void |
executeOnTables(org.dbunit.dataset.filter.ITableFilterSimple aTables,
DatabaseUtils.TableSetOperation aOperation)
|
|
java.sql.ResultSet |
executeQuery(java.sql.Connection aConnection,
java.lang.String aSql)
Executes an SQL query. |
|
java.sql.ResultSet |
executeQuery(java.sql.Connection aConnection,
java.lang.String aSql,
java.lang.Object aArg)
Executes a query with a single argument. |
|
java.sql.ResultSet |
executeQuery(java.sql.Connection aConnection,
java.lang.String aSql,
java.lang.Object[] aArgs)
Executes a query. |
|
int |
executeSql(java.lang.String aSql)
Executes an SQL statement within a transaction. |
|
int |
executeSql(java.lang.String aSql,
java.lang.Object aArg)
Executes an SQL statement within a transaction. |
|
int |
executeSql(java.lang.String aSql,
java.lang.Object[] aArgs)
Executes an sql statement. |
|
int |
executeUpdate(java.sql.Connection aConnection,
java.lang.String aSql,
java.lang.Object... aArgs)
|
|
java.lang.String[] |
getTableNames()
|
|
java.lang.String[] |
getTableNames(org.dbunit.dataset.filter.ITableFilterSimple aSelection)
|
|
int |
getTableSize(java.lang.String aTable)
|
|
void |
start()
Starts the database utils. |
|
void |
stop()
Stops the database utils, closing any JDBC connections that were created by this utility. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DatabaseUtils(javax.sql.DataSource aDataSource,
org.dbunit.dataset.filter.ITableFilterSimple aTables)
start() must be called.
aDataSource - Datasource.aTables - Tables to work with.| Method Detail |
|---|
public void start()
public void stop()
public org.dbunit.IDatabaseTester createDbTester()
throws java.lang.Exception
java.lang.Exception
public org.dbunit.IDatabaseTester createDbTester(java.lang.String[] aTables)
throws java.lang.Exception
java.lang.Exception
public void cleanDatabase()
throws java.lang.Exception
java.lang.Exception
public void executeOnTables(org.dbunit.dataset.filter.ITableFilterSimple aTables,
DatabaseUtils.TableSetOperation aOperation)
throws java.lang.Exception
java.lang.Exception
public void cleanDatabase(org.dbunit.dataset.filter.ITableFilterSimple aSelection)
throws java.lang.Exception
java.lang.Exception
public <T> T executeInTransaction(DatabaseUtils.JdbcUnitOfWork<T> aCallback)
throws java.lang.Exception
java.lang.Exception
public java.lang.String[] getTableNames()
throws java.lang.Exception
java.lang.Exception
public java.lang.String[] getTableNames(org.dbunit.dataset.filter.ITableFilterSimple aSelection)
throws java.lang.Exception
java.sql.SQLException
java.lang.Exception
public void emptyTables()
throws java.lang.Exception
java.lang.Exception
public void emptyTables(org.dbunit.dataset.filter.ITableFilterSimple aSelection)
throws java.lang.Exception
java.sql.SQLException
java.lang.Exception
public void emptyTable(java.lang.String aTable)
throws java.lang.Exception
java.sql.SQLException
java.lang.Exception
public void dropTables()
throws java.lang.Exception
java.lang.Exception
public void dropTables(org.dbunit.dataset.filter.ITableFilterSimple aTables)
throws java.lang.Exception
java.lang.Exception
public void dropTable(java.lang.String aTable)
throws java.lang.Exception
java.sql.SQLException
java.lang.Exception
public int executeSql(java.lang.String aSql)
throws java.lang.Exception
aSql - SQL statement.
java.lang.Exception
public int executeSql(java.lang.String aSql,
java.lang.Object aArg)
throws java.lang.Exception
setPreparedParam(int, PreparedStatement, Object)for details on
supported argument types.
aSql - SQL statement.aArg - Argument of the sql statement.
java.lang.Exception
public int executeSql(java.lang.String aSql,
java.lang.Object[] aArgs)
throws java.lang.Exception
setPreparedParam(int, PreparedStatement, Object)for details on
supported argument types.
aSql - SQL query to execute.aArgs - Arguments.
java.lang.Exception
public java.sql.ResultSet executeQuery(java.sql.Connection aConnection,
java.lang.String aSql)
aSql - Query to execute.
public java.sql.ResultSet executeQuery(java.sql.Connection aConnection,
java.lang.String aSql,
java.lang.Object aArg)
setPreparedParam(int, PreparedStatement, Object)for details on
supported argument types.
aSql - Query.aArg - Argument.
public java.sql.ResultSet executeQuery(java.sql.Connection aConnection,
java.lang.String aSql,
java.lang.Object[] aArgs)
setPreparedParam(int, PreparedStatement, Object)for details on
supported argument types.
aSql - Sql query.aArgs - Arguments to the query.
public int executeUpdate(java.sql.Connection aConnection,
java.lang.String aSql,
java.lang.Object... aArgs)
public int getTableSize(java.lang.String aTable)
throws java.lang.Exception
java.sql.SQLException
java.lang.Exception
public int countResultSet(java.sql.ResultSet aResultSet)
throws java.sql.SQLException
java.sql.SQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||