|
Oracle JDBC API Reference 12c Release 1 ("12.1.0.2.0") E17663-03 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectoracle.sql.Datum
public abstract class Datum
The root of Oracle native datatype hierarchy.
Each subclass represents one of the native kernel datatypes.
In order to allow for possible optimization of data copying between SQL and Java, instances of subclasses are immutable.
| Field Summary | |
|---|---|
static boolean |
TRACE
|
| Constructor Summary | |
|---|---|
Datum()
Creates an empty datum |
|
Datum(byte[] newData)
Create a new datum with the given byte array as representation. |
|
| Method Summary | ||
|---|---|---|
InputStream |
asciiStreamValue()
Convert to an ascii stream representation of the datum object |
|
BigDecimal |
bigDecimalValue()
Convert to a BigDecimal representation of the datum object |
|
InputStream |
binaryStreamValue()
Convert to a binary stream representation of the datum object |
|
boolean |
booleanValue()
Convert to a boolean representation of the datum object |
|
protected boolean |
bytesEqual(Datum other)
|
|
byte |
byteValue()
Convert to a byte representation of the datum object |
|
Reader |
characterStreamValue()
Convert to a character stream representation of the datum object |
|
protected static int |
compareBytes(byte[] m,
byte[] n)
Do an unsigned compare on byte arrays m and n |
|
Date |
dateValue()
Convert to a Date representation of the datum object |
|
double |
doubleValue()
Convert to a double representation of the datum object |
|
boolean |
equals(Object obj)
Test any object for equality with an Datum. |
|
float |
floatValue()
Convert to a float representation of the datum object |
|
byte[] |
getBytes()
Create a new Java byte array containing a copy of the RDBMS data. |
|
protected oracle.jdbc.internal.OracleConnection |
getConnectionDuringExceptionHandling()
|
|
long |
getLength()
Retreive the length of a datum. |
|
InputStream |
getStream()
Create an input stream so the raw data may be read. |
|
int |
intValue()
Convert to a integer representation of the datum object |
|
abstract boolean |
isConvertibleTo(Class cls)
Determines if datum object can be converted to a particular class |
|
boolean |
isNull()
Test if this Datum is empty |
|
long |
longValue()
Convert to a long representation of the datum object |
|
abstract Object |
makeJdbcArray(int arraySize)
Returns a JDBC array representation of the datum |
|
void |
setBytes(byte[] array)
Sets datum value using a byte array. |
|
void |
setShareBytes(byte[] array)
Sets datum value using a byte array. |
|
byte[] |
shareBytes()
Retrieve the data bytes. |
|
String |
stringValue()
Convert to a String representation of the datum object |
|
String |
stringValue(Connection conn)
Some Datum subclass such as TIMESTAMPTZ will override this default implementation which simply ignores the the connection. |
|
Timestamp |
timestampValue()
Convert to a Timestamp representation of the datum object |
|
Timestamp |
timestampValue(Calendar cal)
|
|
Time |
timeValue()
Convert to a Time representation of the datum object |
|
Time |
timeValue(Calendar cal)
|
|
|
toClass(Class<T> type)
Convert this datum to an instance of the specified type if possible. |
|
abstract Object |
toJdbc()
Returns the JDBC representation of the datum object |
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final boolean TRACE
| Constructor Detail |
|---|
public Datum()
public Datum(byte[] newData)
data array.
newData - byte array to be stored in the datum| Method Detail |
|---|
public boolean equals(Object obj)
equals in class Objectobj - object to compare this with
this is the same as the class of
obj and the byte representation of this is the
same as the byte representation of obj.public byte[] shareBytes()
Used by java code in subclasses to access the data bytes. If the bytes are not yet a Java array, this may cause them to be copied into one.
public long getLength()
public void setBytes(byte[] array)
array - byte array used to set the datum valuepublic void setShareBytes(byte[] array)
array - byte array used to set the datum valuepublic byte[] getBytes()
For now, the data array is simply copied. When we are using moss to go directly to the buffer cache, this implementation will be overridden by a native method which will cons an array and copy the bytes into it.
Subclasses which handle very long datatypes which will not ordinarily be represented as Java array, should check for allocation failure and return nil if detected. They should however try to materialize the raw data no matter how long since users may actually need to materialize huge arrays.
public boolean isNull()
public InputStream getStream()
This is the normal way to access long datatypes.
public String stringValue()
throws SQLException
SQLException, - if no String representation exists
SQLException
public String stringValue(Connection conn)
throws SQLException
SQLException
public boolean booleanValue()
throws SQLException
SQLException, - if no boolean representation exists
SQLException
public int intValue()
throws SQLException
SQLException, - if no integer representation exists
SQLException
public long longValue()
throws SQLException
SQLException, - if no long representation exists
SQLException
public float floatValue()
throws SQLException
SQLException, - if no float representation exists
SQLException
public double doubleValue()
throws SQLException
SQLException, - if no double representation exists
SQLException
public byte byteValue()
throws SQLException
SQLException, - if no byte representation exists
SQLException
public BigDecimal bigDecimalValue()
throws SQLException
SQLException, - if no BigDecimal representation exists
SQLException
public Date dateValue()
throws SQLException
SQLException, - if no Date representation exists
SQLException
public Time timeValue()
throws SQLException
SQLException, - if no Time representation exists
SQLException
public Time timeValue(Calendar cal)
throws SQLException
SQLException
public Timestamp timestampValue()
throws SQLException
SQLException, - if no Timestamp representation exists
SQLException
public Timestamp timestampValue(Calendar cal)
throws SQLException
SQLException
public Reader characterStreamValue()
throws SQLException
SQLException, - if no character stream representation exists
SQLException
public InputStream asciiStreamValue()
throws SQLException
SQLException, - if no ascii stream representation exists
SQLException
public InputStream binaryStreamValue()
throws SQLException
SQLException, - if no binary stream representation exists
SQLExceptionpublic abstract boolean isConvertibleTo(Class cls)
cls - Class to convert to
public <T> T toClass(Class<T> type)
throws SQLException
type - Target class
SQLException - if the conversion is not possible.
public abstract Object toJdbc()
throws SQLException
SQLException - if conversion to JDBC representation results in
an errorpublic abstract Object makeJdbcArray(int arraySize)
arraySize - size of the array
protected static int compareBytes(byte[] m,
byte[] n)
m - input byte arrayn - input byte array
protected boolean bytesEqual(Datum other)
protected oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
|
Oracle JDBC API Reference 12c Release 1 ("12.1.0.2.0") E17663-03 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||