org.dbunit.database
Class AbstractDatabaseConnection

java.lang.Object
  extended by org.dbunit.database.AbstractDatabaseConnection
All Implemented Interfaces:
IDatabaseConnection
Direct Known Subclasses:
DatabaseConnection, DatabaseDataSourceConnection

public abstract class AbstractDatabaseConnection
extends Object
implements IDatabaseConnection

Since:
Mar 6, 2002
Version:
$Revision: 886 $
Author:
Manuel Laflamme

Constructor Summary
AbstractDatabaseConnection()
           
 
Method Summary
 IDataSet createDataSet()
          Creates a dataset corresponding to the entire database.
 IDataSet createDataSet(String[] tableNames)
          Creates a dataset containing only the specified tables from the database.
 ITable createQueryTable(String resultName, String sql)
          Creates a table with the result of the specified SQL statement.
 ITable createTable(String tableName)
          Creates a table with the result of a select * from tableName SQL statement.
 DatabaseConfig getConfig()
          Returns this connection database configuration
 int getRowCount(String tableName)
          Returns the specified table row count.
 int getRowCount(String tableName, String whereClause)
          Returns the specified table row count according specified where clause.
 IStatementFactory getStatementFactory()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.dbunit.database.IDatabaseConnection
close, getConnection, getSchema
 

Constructor Detail

AbstractDatabaseConnection

public AbstractDatabaseConnection()
Method Detail

createDataSet

public IDataSet createDataSet()
                       throws SQLException
Description copied from interface: IDatabaseConnection
Creates a dataset corresponding to the entire database.

Specified by:
createDataSet in interface IDatabaseConnection
Throws:
SQLException

createDataSet

public IDataSet createDataSet(String[] tableNames)
                       throws DataSetException,
                              SQLException
Description copied from interface: IDatabaseConnection
Creates a dataset containing only the specified tables from the database.

Specified by:
createDataSet in interface IDatabaseConnection
Parameters:
tableNames - The tables for which a dataset shall be created
Returns:
The new dataset
Throws:
DataSetException
SQLException

createQueryTable

public ITable createQueryTable(String resultName,
                               String sql)
                        throws DataSetException,
                               SQLException
Description copied from interface: IDatabaseConnection
Creates a table with the result of the specified SQL statement. The table can be the result of a join statement.

Specified by:
createQueryTable in interface IDatabaseConnection
Parameters:
resultName - The name to be returned by ITableMetaData.getTableName().
sql - The SQL SELECT statement
Returns:
The new table
Throws:
DataSetException
SQLException

createTable

public ITable createTable(String tableName)
                   throws DataSetException,
                          SQLException
Description copied from interface: IDatabaseConnection
Creates a table with the result of a select * from tableName SQL statement.

Specified by:
createTable in interface IDatabaseConnection
Parameters:
tableName - The name of the database table to be queried which is also returned by ITableMetaData.getTableName().
Throws:
DataSetException
SQLException

getRowCount

public int getRowCount(String tableName)
                throws SQLException
Description copied from interface: IDatabaseConnection
Returns the specified table row count.

Specified by:
getRowCount in interface IDatabaseConnection
Parameters:
tableName - the table name
Returns:
the row count
Throws:
SQLException

getRowCount

public int getRowCount(String tableName,
                       String whereClause)
                throws SQLException
Description copied from interface: IDatabaseConnection
Returns the specified table row count according specified where clause.

Specified by:
getRowCount in interface IDatabaseConnection
Parameters:
tableName - the table name
whereClause - the where clause
Returns:
the row count
Throws:
SQLException

getConfig

public DatabaseConfig getConfig()
Description copied from interface: IDatabaseConnection
Returns this connection database configuration

Specified by:
getConfig in interface IDatabaseConnection

getStatementFactory

public IStatementFactory getStatementFactory()
Specified by:
getStatementFactory in interface IDatabaseConnection

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2012. All Rights Reserved.