prefuse.data.io.sql
Class DefaultSQLDataHandler

java.lang.Object
  extended by prefuse.data.io.sql.DefaultSQLDataHandler
All Implemented Interfaces:
SQLDataHandler

public class DefaultSQLDataHandler
extends java.lang.Object
implements SQLDataHandler

Default data value handler for mapping SQL data types to Java objects. Performs a straightforward mapping of common SQL data types to Java primitives or objects.

Author:
jeffrey heer

Constructor Summary
DefaultSQLDataHandler()
          Create a new DefaultSQLDataHandler.
DefaultSQLDataHandler(boolean ignoreUnknownTypes)
          Create a new DefaultSQLDataHandler.
 
Method Summary
 java.lang.Class getDataType(java.lang.String columnName, int sqlType)
          Return the Java data type for the given data field name and its sql data type.
 boolean isIgnoreUnknownTypes()
          Indicates if unknown or unrecognized SQL data types should simply be ignored.
 void process(Table t, int trow, java.sql.ResultSet rset, int rcol)
          Process a data value from a ResultSet, translating it into a Java data value and storing it in a Table.
 void setIgnoreUnknownTypes(boolean ignore)
          Set if unknown or unrecognized SQL data types should simply be ignored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSQLDataHandler

public DefaultSQLDataHandler()
Create a new DefaultSQLDataHandler.


DefaultSQLDataHandler

public DefaultSQLDataHandler(boolean ignoreUnknownTypes)
Create a new DefaultSQLDataHandler.

Parameters:
ignoreUnknownTypes - instructs the data handler whether or not unknown or unrecognized SQL data types should simply be ignored
Method Detail

setIgnoreUnknownTypes

public void setIgnoreUnknownTypes(boolean ignore)
Set if unknown or unrecognized SQL data types should simply be ignored.

Parameters:
ignore - the ignore unknown types setting to use

isIgnoreUnknownTypes

public boolean isIgnoreUnknownTypes()
Indicates if unknown or unrecognized SQL data types should simply be ignored.

Returns:
the ignore unknown types setting

process

public void process(Table t,
                    int trow,
                    java.sql.ResultSet rset,
                    int rcol)
             throws java.sql.SQLException
Description copied from interface: SQLDataHandler
Process a data value from a ResultSet, translating it into a Java data value and storing it in a Table.

Specified by:
process in interface SQLDataHandler
Parameters:
t - the Table in which to store the result value
trow - the Table row to add to
rset - the ResultSet to read the SQL value from, assumed to be set to the desired row
rcol - the column index of the data value in the row set. This is also used to look up the column name, which is used to access the correct data field of the Table.
Throws:
java.sql.SQLException - if an error occurs accessing the ResultSet
See Also:
SQLDataHandler.process(prefuse.data.Table, int, java.sql.ResultSet, int)

getDataType

public java.lang.Class getDataType(java.lang.String columnName,
                                   int sqlType)
Description copied from interface: SQLDataHandler
Return the Java data type for the given data field name and its sql data type.

Specified by:
getDataType in interface SQLDataHandler
Parameters:
columnName - the name of data field / column
sqlType - the field's sql data type, one of the constants in the Types class.
Returns:
the Java Class data type
See Also:
SQLDataHandler.getDataType(java.lang.String, int)


Copyright © 2007 Regents of the University of California