KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbunit > database > IDatabaseConnection


1 /*
2  *
3  * The DbUnit Database Testing Framework
4  * Copyright (C)2002-2004, DbUnit.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */

21
22 package org.dbunit.database;
23
24 import org.dbunit.database.statement.IStatementFactory;
25 import org.dbunit.dataset.DataSetException;
26 import org.dbunit.dataset.IDataSet;
27 import org.dbunit.dataset.ITable;
28
29 import java.sql.Connection JavaDoc;
30 import java.sql.SQLException JavaDoc;
31
32 /**
33  * This interface represents a connection to a specific database.
34  *
35  * @author Manuel Laflamme
36  * @version $Revision: 1.15 $
37  * @since Mar 6, 2002
38  */

39 public interface IDatabaseConnection
40 {
41     /**
42      * Returns a JDBC database connection.
43      */

44     public Connection JavaDoc getConnection() throws SQLException JavaDoc;
45
46     /**
47      * Returns the database schema name.
48      */

49     public String JavaDoc getSchema();
50
51     /**
52      * Close this connection.
53      */

54     public void close() throws SQLException JavaDoc;
55
56     /**
57      * Creates a dataset corresponding to the entire database.
58      */

59     public IDataSet createDataSet() throws SQLException JavaDoc;
60
61     /**
62      * Creates a dataset containing only the specified tables from
63      * the database.
64      */

65     public IDataSet createDataSet(String JavaDoc[] tableNames) throws SQLException JavaDoc;
66
67     /**
68      * Creates a table with the result of the specified SQL statement. The
69      * table can be the result of a join statement.
70      *
71      * @param resultName The name to be returned by {@link org.dbunit.dataset.ITableMetaData#getTableName}.
72      * @param sql The SQL <code>SELECT</code> statement
73      */

74     public ITable createQueryTable(String JavaDoc resultName, String JavaDoc sql)
75             throws DataSetException, SQLException JavaDoc;
76
77     /**
78      * Returns the specified table row count.
79      *
80      * @param tableName the table name
81      * @return the row count
82      */

83     public int getRowCount(String JavaDoc tableName) throws SQLException JavaDoc;
84
85     /**
86      * Returns the specified table row count according specified where clause.
87      *
88      * @param tableName the table name
89      * @param whereClause the where clause
90      * @return the row count
91      */

92     public int getRowCount(String JavaDoc tableName, String JavaDoc whereClause) throws SQLException JavaDoc;
93
94     /**
95      * Returns this connection database configuration
96      */

97     public DatabaseConfig getConfig();
98
99     /**
100      * @deprecated Use {@link #getConfig}
101      */

102     public IStatementFactory getStatementFactory();
103 }
104
105
106
107
108
109
110
111
112
Popular Tags