oracle.jdbc.internal.ObjectData
public interface CustomDatum
extends oracle.jdbc.internal.ObjectData
This is an interface for encapsulating SQL Types into Java types of the user's choice. The user class can present a customized version of the SQL type. You can get and set values of the Java type as appropriate.
You can have lots of different classes implementing CustomDatum for a particular SQLType but generally each type implementing CustomDatum will be used for only a single SQLType.
The original motivation for this class is the jpub generator which examines SQL types (especially Object types) and creates "well typed" java versions. This includes Object types, Ref types and Array types.
It was also partially "inspired" by the jdbc2 SQLData interface.For use as a SQLJ type a class that implements CustomDatum will contain static fields and methods declared as
public static CustomDatumFactory getFactory() ... public static final int _SQLJ_TYPECODE = oracle.jdbc.driver.Types ....; // for STRUCT and ARRAY public static final String _SQLJ_name="O____" ; // for REF and ARRAY public static final String _SQLJ_BASETYPE = "...." ;
Typical use would be
Emp e = ... OraclePreparedStatement stmt = .... ; stmt.setCustom(n, e);
CustomDatumFactory
, oracle.jdbc.driver.PreparedStatement
, SQLData
Modifier and Type | Method | Description |
---|---|---|
Datum |
toDatum(oracle.jdbc.driver.OracleConnection c) |
Called by setOracleObject to extract a Datum.
|
Datum toDatum(oracle.jdbc.driver.OracleConnection c) throws SQLException
Most EmbedDatum's will ignore the connection, but it is occassionally needed. For example, if the class embeds CHAR's it may nees the connection to determine the database character set.
c
- The connection into which the value is being sent.SQLException