KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > prefuse > data > io > sql > SQLDataHandler


1 package prefuse.data.io.sql;
2
3 import java.sql.ResultSet JavaDoc;
4 import java.sql.SQLException JavaDoc;
5
6 import prefuse.data.Table;
7
8 /**
9  * Interface for taking a value in a SQL ResultSet and translating it into
10  * a Java data value for use in a prefuse Table.
11  *
12  * @author <a HREF="http://jheer.org">jeffrey heer</a>
13  */

14 public interface SQLDataHandler {
15
16     /**
17      * Process a data value from a ResultSet, translating it into a
18      * Java data value and storing it in a Table.
19      * @param t the Table in which to store the result value
20      * @param trow the Table row to add to
21      * @param rset the ResultSet to read the SQL value from, assumed
22      * to be set to the desired row
23      * @param rcol the column index of the data value in the row set.
24      * This is also used to look up the column name, which is used
25      * to access the correct data field of the Table.
26      * @throws SQLException if an error occurs accessing the ResultSet
27      */

28     public void process(Table t, int trow, ResultSet JavaDoc rset, int rcol)
29         throws SQLException JavaDoc;
30     
31     /**
32      * Return the Java data type for the given data field name and
33      * its sql data type.
34      * @param columnName the name of data field / column
35      * @param sqlType the field's sql data type, one of the constants
36      * in the {@link java.sql.Types} class.
37      * @return the Java Class data type
38      */

39     public Class JavaDoc getDataType(String JavaDoc columnName, int sqlType);
40     
41 } // end of interface SQLDataValueHandler
42
Popular Tags