org.dbunit.database
Class QueryDataSet

java.lang.Object
  extended byorg.dbunit.dataset.AbstractDataSet
      extended byorg.dbunit.database.QueryDataSet
All Implemented Interfaces:
IDataSet

public class QueryDataSet
extends AbstractDataSet

Holds collection of tables resulting from database query.

Since:
Dec 4, 2002
Version:
$Revision: 1.8 $
Author:
Eric Pugh

Constructor Summary
QueryDataSet(IDatabaseConnection connection)
          Create a QueryDataSet by passing in the connection to the database to use.
 
Method Summary
 void addTable(java.lang.String tableName)
          Adds a table with using 'SELECT * FROM tableName' as query.
 void addTable(java.lang.String tableName, java.lang.String query)
          Adds a table and it's associted query to this dataset.
protected  ITableIterator createIterator(boolean reversed)
           
 java.lang.String[] getTableNames()
          Returns names of tables in this dataset in proper sequence.
 
Methods inherited from class org.dbunit.dataset.AbstractDataSet
cloneTables, getTable, getTableMetaData, getTables, iterator, reverseIterator, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryDataSet

public QueryDataSet(IDatabaseConnection connection)
             throws java.sql.SQLException
Create a QueryDataSet by passing in the connection to the database to use.

Parameters:
connection - The connection object to the database.
Throws:
java.sql.SQLException - Description of the Exception
Method Detail

addTable

public void addTable(java.lang.String tableName,
                     java.lang.String query)
Adds a table and it's associted query to this dataset.

Parameters:
tableName - The name of the table
query - The query to retrieve data with for this table

addTable

public void addTable(java.lang.String tableName)
Adds a table with using 'SELECT * FROM tableName' as query.

Parameters:
tableName - The name of the table

createIterator

protected ITableIterator createIterator(boolean reversed)
                                 throws DataSetException
Specified by:
createIterator in class AbstractDataSet
Throws:
DataSetException

getTableNames

public java.lang.String[] getTableNames()
                                 throws DataSetException
Description copied from interface: IDataSet
Returns names of tables in this dataset in proper sequence. Multiple occurence of the same name may be returned if multiple tables having the same name are present in the dataset.

Specified by:
getTableNames in interface IDataSet
Overrides:
getTableNames in class AbstractDataSet
Throws:
DataSetException


Copyright © 2002-2004 DbUnit.org. All Rights Reserved.