01: package prefuse.data.io.sql;
02:
03: import java.sql.ResultSet;
04: import java.sql.SQLException;
05:
06: import prefuse.data.Table;
07:
08: /**
09: * 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 rset, int rcol)
29: throws SQLException;
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 getDataType(String columnName, int sqlType);
40:
41: } // end of interface SQLDataValueHandler
|