|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.afcs.warts.handlers.DataHandlerSupport
org.afcs.warts.handlers.CharacterHandler
The CharacterHandler class handles the loading, printing,
and binding of database columns containing character data (i.e., columns of
type CHAR and VARCHAR). All character data loaded using this handler is
stored in DataHighBitAnalysis
instances, allowing encoding analysis to be performed without further
conversion.
This class contains a workaround for an Oracle JDBC driver bug where data is not loaded correctly from CHAR columns with character length semantics. These are padded with extra characters by the driver, where the number of padding characters depends on the number of non-ascii characters in the field. These cases are truncated. The bug has been documented in a post to Oracle's JDBC forum.
LICENSE: This code is released to the public domain and may be used for any purpose whatsoever without permission or acknowledgment.
Constructor Summary | |
CharacterHandler(TableDescription tableDescription,
ColumnDescription columnDescription)
Constructs a new instance on behalf of subclasses that will handle data values for the specified column in the specified table. |
Method Summary | |
void |
bindNonNullValue(java.sql.PreparedStatement statement,
int columnIndex,
java.lang.Object value)
Given a prepared statement and a column index, this method binds the specified value to the specified column in the specified prepared statement, using a binding appropriate to character data. |
boolean |
isCharacterData()
Always returns true. |
java.lang.Object |
loadValue(java.sql.ResultSet resultSet,
int columnIndex)
This method loads the character data associated with the specified column in the specified result set, returning a DataHighBitAnalysis instance
containing analysis of the character data, if some exists, or null
otherwise. |
java.lang.String |
printNonNullValue(java.lang.Object value)
Returns a string containing a representation of the specified value appropriate for use in a SQL script. |
Methods inherited from class org.afcs.warts.handlers.DataHandlerSupport |
getColumnDescription, getNullType, getTableDescription, isNullHandler, loadBytesFromStream, logWrongValueTypeWarning, postProcessBind, requiresBindPostProcessing, requiresStreamedLoading, toString, verifyObjectIsString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.afcs.warts.handlers.DataHandler |
getNullType, isNullHandler, postProcessBind, requiresBindPostProcessing, requiresStreamedLoading |
Constructor Detail |
public CharacterHandler(TableDescription tableDescription, ColumnDescription columnDescription)
tableDescription
- The table that the handler will be handling data
for.columnDescription
- The column that this class will be processing
data for.Method Detail |
public void bindNonNullValue(java.sql.PreparedStatement statement, int columnIndex, java.lang.Object value) throws java.sql.SQLException
bindNonNullValue
in interface DataHandler
statement
- The statement to bind the value to.columnIndex
- The index of the variable to bind the value to.value
- The value to bind. This must be a character data type,
such as a DataHighBitAnalysis
instance, a String instance, or
null.
java.sql.SQLException
- If a SQL error occurs.public boolean isCharacterData()
isCharacterData
in interface DataHandler
isCharacterData
in class DataHandlerSupport
public java.lang.Object loadValue(java.sql.ResultSet resultSet, int columnIndex) throws java.sql.SQLException
DataHighBitAnalysis
instance
containing analysis of the character data, if some exists, or null
otherwise.
loadValue
in interface DataHandler
resultSet
- The result set to load the value from.columnIndex
- The column to load the value from.
java.sql.SQLException
- If a SQL error occurs.public java.lang.String printNonNullValue(java.lang.Object value)
printNonNullValue
in interface DataHandler
value
- The value to print. This must be a character data type,
such as a DataHighBitAnalysis
instance, a String instance, or
null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |