|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.iapi.types.DataType
org.apache.derby.iapi.types.SQLChar
org.apache.derby.iapi.types.SQLVarchar
org.apache.derby.iapi.types.SQLClob
public class SQLClob
SQLClob represents a CLOB value with UCS_BASIC collation. CLOB supports LIKE operator only for collation.
| Nested Class Summary | |
|---|---|
private static class |
SQLClob.HeaderInfo
Holder class for header information gathered from the raw byte header in the stream. |
| Field Summary | |
|---|---|
private CharacterStreamDescriptor |
csd
The descriptor for the stream. |
private java.lang.Boolean |
inSoftUpgradeMode
Tells if the database is being accessed in soft upgrade mode. |
private static int |
MAX_STREAM_HEADER_LENGTH
The maximum number of bytes used by the stream header. |
private static StreamHeaderGenerator |
TEN_FIVE_CLOB_HEADER_GENERATOR
The header generator used for 10.5 databases. |
private static StreamHeaderGenerator |
TEN_FOUR_CLOB_HEADER_GENERATOR
The header generator used for 10.4 (or older) databases. |
| Fields inherited from class org.apache.derby.iapi.types.SQLChar |
|---|
_clobValue, arg_passer, CHAR_HEADER_GENERATOR, RETURN_SPACE_THRESHOLD, stream |
| Fields inherited from interface org.apache.derby.iapi.types.StringDataValue |
|---|
BOTH, COLLATION_DERIVATION_EXPLICIT, COLLATION_DERIVATION_IMPLICIT, COLLATION_DERIVATION_NONE, COLLATION_TYPE_TERRITORY_BASED, COLLATION_TYPE_TERRITORY_BASED_IDENTICAL, COLLATION_TYPE_TERRITORY_BASED_PRIMARY, COLLATION_TYPE_TERRITORY_BASED_SECONDARY, COLLATION_TYPE_TERRITORY_BASED_TERTIARY, COLLATION_TYPE_UCS_BASIC, LEADING, TRAILING |
| Fields inherited from interface org.apache.derby.iapi.types.DataValueDescriptor |
|---|
UNKNOWN_LOGICAL_LENGTH |
| Fields inherited from interface org.apache.derby.iapi.types.Orderable |
|---|
ORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN |
| Fields inherited from interface org.apache.derby.iapi.types.VariableSizeDataValue |
|---|
IGNORE_PRECISION |
| Constructor Summary | |
|---|---|
SQLClob()
|
|
SQLClob(java.sql.Clob val)
|
|
SQLClob(java.lang.String val)
|
|
| Method Summary | |
|---|---|
DataValueDescriptor |
cloneValue(boolean forceMaterialization)
Returns a clone of this CLOB value. |
boolean |
getBoolean()
Get Boolean from a SQLChar. |
byte |
getByte()
Get Byte from a SQLChar. |
byte[] |
getBytes()
Gets the value in the data value descriptor as a byte[]. |
java.sql.Date |
getDate(java.util.Calendar cal)
Get date from a SQLChar. |
double |
getDouble()
Get double from a SQLChar. |
float |
getFloat()
Get float from a SQLChar. |
int |
getInt()
Get int from a SQLChar. |
int |
getLength()
Returns the character length of this Clob. |
long |
getLong()
Get long from a SQLChar. |
DataValueDescriptor |
getNewNull()
Get a new null value of the same type as this data value. |
java.lang.Object |
getObject()
Gets the value in the data value descriptor as a int. |
short |
getShort()
Get Short from a SQLChar. |
StreamHeaderGenerator |
getStreamHeaderGenerator()
Returns a stream header generator for a Clob. |
CharacterStreamDescriptor |
getStreamWithDescriptor()
Returns a descriptor for the input stream for this CLOB value. |
java.sql.Time |
getTime(java.util.Calendar cal)
Get time from a SQLChar. |
java.sql.Timestamp |
getTimestamp(java.util.Calendar cal)
Get Timestamp from a SQLChar. |
java.lang.String |
getTraceString()
Gets a trace representation of the CLOB for debugging. |
int |
getTypeFormatId()
Return my format identifier. |
java.lang.String |
getTypeName()
Get the SQL name of the datatype |
StringDataValue |
getValue(java.text.RuleBasedCollator collatorForComparison)
Gets either SQLChar/SQLVarchar/SQLLongvarchar/SQLClob(base classes) or CollatorSQLChar/CollatorSQLVarchar/CollatorSQLLongvarch/CollatorSQLClob (subclasses). |
boolean |
hasStream()
Tells if this CLOB value is, or will be, represented by a stream. |
private SQLClob.HeaderInfo |
investigateHeader(byte[] hdr,
int bytesRead)
Investigates the header and returns length information. |
void |
normalize(DataTypeDescriptor desiredType,
DataValueDescriptor sourceValue)
Normalization method - this method may be called when putting a value into a SQLClob, for example, when inserting into a SQLClob column. |
void |
readExternal(java.io.ObjectInput in)
Reads and materializes the CLOB value from the stream. |
void |
readExternalFromArray(ArrayInputStream in)
Reads and materializes the CLOB value from the stream. |
void |
restoreToNull()
Restore this object to its (SQL)null value. |
private void |
rewindStream(java.io.InputStream in,
long offset)
Rewinds the stream to the beginning and then skips the specified number of bytes. |
void |
setBigDecimal(java.lang.Number bigDecimal)
Only to be called when an application through JDBC is setting a SQLChar to a java.math.BigDecimal. |
(package private) void |
setObject(java.lang.Object theValue)
Set the value from an non-null Java.sql.Clob object. |
void |
setStream(java.io.InputStream stream)
Sets a new stream for this CLOB. |
void |
setStreamHeaderFormat(java.lang.Boolean inSoftUpgradeMode)
Tells whether the database is being accessed in soft upgrade mode or not. |
void |
setValue(boolean theValue)
Set the value. |
void |
setValue(byte theValue)
Set the value of this DataValueDescriptor to the given byte value At DataType level just throws an error lower classes will override |
void |
setValue(byte[] theValue)
Set the value of this DataValueDescriptor. |
void |
setValue(java.sql.Date theValue,
java.util.Calendar cal)
Set the value of this DataValueDescriptor. |
void |
setValue(double theValue)
Set the value of this DataValueDescriptor to the given double value At DataType level just throws an error lower classes will override |
void |
setValue(float theValue)
Set the value of this DataValueDescriptor to the given float value At DataType level just throws an error lower classes will override |
void |
setValue(int theValue)
Set the value of this DataValueDescriptor to the given int value At DataType level just throws an error lower classes will override |
void |
setValue(long theValue)
Set the value of this DataValueDescriptor to the given long value At DataType level just throws an error lower classes will override |
void |
setValue(short theValue)
Set the value of this DataValueDescriptor to the given short value At DataType level just throws an error lower classes will override |
void |
setValue(java.sql.Time theValue,
java.util.Calendar cal)
Set the value of this DataValueDescriptor. |
void |
setValue(java.sql.Timestamp theValue,
java.util.Calendar cal)
Set the value of this DataValueDescriptor. |
int |
typePrecedence()
Each built-in type in JSQL has a precedence. |
int |
typeToBigDecimal()
CHAR/VARCHAR/LONG VARCHAR implementation. |
void |
writeExternal(java.io.ObjectOutput out)
Writes the CLOB data value to the given destination stream using the modified UTF-8 format. |
| Methods inherited from class org.apache.derby.iapi.types.SQLVarchar |
|---|
growBy, normalize |
| Methods inherited from class org.apache.derby.iapi.types.SQLChar |
|---|
ansiTrim, charLength, cloneHolder, compare, compare, concatenate, copyState, equals, estimateMemoryUsage, getCharArray, getCollationKey, getCollatorForCollation, getDate, getLocaleFinder, getNewVarchar, getRawDataAndZeroIt, getStream, getString, getTime, getTimestamp, greaterOrEquals, greaterThan, hashCode, hashCodeForCollation, hasNonBlankChars, isNull, lessOrEquals, lessThan, like, like, loadStream, locate, lower, notEquals, readExternal, readExternalClobFromArray, returnStream, setFrom, setInto, setLocaleFinder, setObjectForCast, setValue, setValue, setValue, setValueFromResultSet, setWidth, stringCompare, stringCompare, stringCompare, substring, throwStreamingIOException, toString, upper, writeClobUTF, zeroRawData |
| Methods inherited from class org.apache.derby.iapi.types.DataType |
|---|
checkHostVariable, coalesce, compare, compare, compareTo, dataTypeConversion, equals, flip, genericSetObject, getTypeName, in, invalidFormat, isNotNull, isNullOp, outOfRange, recycle, setInto, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, throwLangSetMismatch, throwLangSetMismatch |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.derby.iapi.types.DataValueDescriptor |
|---|
checkHostVariable, coalesce, compare, compare, in, isNotNull, isNullOp, recycle, setInto, setToNull, setValue, setValue, setValue, setValue, setValue, setValue |
| Field Detail |
|---|
private static final StreamHeaderGenerator TEN_FOUR_CLOB_HEADER_GENERATOR
private static final StreamHeaderGenerator TEN_FIVE_CLOB_HEADER_GENERATOR
private static final int MAX_STREAM_HEADER_LENGTH
Use the length specified by the ten five header generator.
private CharacterStreamDescriptor csd
null, which is also true if the descriptor hasen't been
constructed yet.
Note: Always check if stream is non-null before using
the information stored in the descriptor internally.
private java.lang.Boolean inSoftUpgradeMode
| Constructor Detail |
|---|
public SQLClob()
public SQLClob(java.lang.String val)
public SQLClob(java.sql.Clob val)
| Method Detail |
|---|
public java.lang.String getTypeName()
DataValueDescriptor
getTypeName in interface DataValueDescriptorgetTypeName in class SQLVarcharpublic DataValueDescriptor cloneValue(boolean forceMaterialization)
Unlike the other binary types, CLOBs can be very large. We try to clone the underlying stream when possible to avoid having to materialize the value into memory.
cloneValue in interface DataValueDescriptorcloneValue in class SQLVarcharforceMaterialization - any streams representing the data value will
be materialized if true, the data value will be kept as a
stream if possible if false
DataValueDescriptor.cloneValue(boolean)public DataValueDescriptor getNewNull()
DataValueDescriptor
getNewNull in interface DataValueDescriptorgetNewNull in class SQLVarcharDataValueDescriptor.getNewNull()public StringDataValue getValue(java.text.RuleBasedCollator collatorForComparison)
StringDataValue
getValue in interface StringDataValuegetValue in class SQLVarcharStringDataValue.getValue(RuleBasedCollator)public int getTypeFormatId()
getTypeFormatId in interface TypedFormatgetTypeFormatId in class SQLVarcharTypedFormat.getTypeFormatId()public int typePrecedence()
DataType
typePrecedence in interface DataValueDescriptortypePrecedence in class SQLVarcharDataValueDescriptor.typePrecedence()
public boolean getBoolean()
throws StandardException
SQLCharReturn false for only "0" or "false" for false. No case insensitivity. Everything else is true.
The above matches JCC and the client driver.
getBoolean in interface DataValueDescriptorgetBoolean in class SQLCharStandardException - Thrown on errorDataValueDescriptor.getBoolean()
public byte getByte()
throws StandardException
SQLCharUses java standard Byte.parseByte() to perform coercion.
getByte in interface DataValueDescriptorgetByte in class SQLCharStandardException - thrown on failure to convertDataValueDescriptor.getByte()
public short getShort()
throws StandardException
SQLCharUses java standard Short.parseShort() to perform coercion.
getShort in interface DataValueDescriptorgetShort in class SQLCharStandardException - thrown on failure to convertDataValueDescriptor.getShort()
public int getInt()
throws StandardException
SQLCharUses java standard Short.parseInt() to perform coercion.
getInt in interface DataValueDescriptorgetInt in class SQLCharStandardException - thrown on failure to convertDataValueDescriptor.getInt()
public int getLength()
throws StandardException
If the value is stored as a stream, the stream header will be read. If the stream header doesn't contain the stream length, the whole stream will be decoded to determine the length.
getLength in interface DataValueDescriptorgetLength in class SQLCharStandardException - if obtaining the length fails
public long getLong()
throws StandardException
SQLCharUses java standard Short.parseLong() to perform coercion.
getLong in interface DataValueDescriptorgetLong in class SQLCharStandardException - thrown on failure to convertDataValueDescriptor.getLong()
public float getFloat()
throws StandardException
SQLCharUses java standard Float.floatValue() to perform coercion.
getFloat in interface DataValueDescriptorgetFloat in class SQLCharStandardException - thrown on failure to convertDataValueDescriptor.getFloat()
public double getDouble()
throws StandardException
SQLCharUses java standard Double.doubleValue() to perform coercion.
getDouble in interface DataValueDescriptorgetDouble in class SQLCharStandardException - thrown on failure to convertDataValueDescriptor.getDouble()
public int typeToBigDecimal()
throws StandardException
SQLChar
typeToBigDecimal in interface DataValueDescriptortypeToBigDecimal in class SQLCharStandardException - Conversion is not possible
public byte[] getBytes()
throws StandardException
DataType
getBytes in interface DataValueDescriptorgetBytes in class DataTypeStandardException - Thrown on error
public java.sql.Date getDate(java.util.Calendar cal)
throws StandardException
SQLChar
getDate in interface DataValueDescriptorgetDate in class SQLCharcal - calendar for object creation
StandardException - thrown on failure to convertDataValueDescriptor.getDate(java.util.Calendar)
public java.lang.Object getObject()
throws StandardException
DataType
getObject in interface DataValueDescriptorgetObject in class SQLCharStandardException - Thrown on error
public CharacterStreamDescriptor getStreamWithDescriptor()
throws StandardException
The descriptor contains information about header data, current positions, length, whether the stream should be buffered or not, and if the stream is capable of repositioning itself.
When this method returns, the stream is positioned on the first character position, such that the next read will return the first character in the stream.
getStreamWithDescriptor in interface StringDataValuegetStreamWithDescriptor in class SQLCharnull is returned instead of a descriptor.
StandardException - if obtaining the descriptor failsgetStreamWithDescriptor()public boolean hasStream()
hasStream in interface DataValueDescriptorhasStream in class DataTypetrue if the value is represented by a stream,
false otherwise.DataValueDescriptor.getStream(),
StringDataValue.getStreamWithDescriptor()
public java.sql.Time getTime(java.util.Calendar cal)
throws StandardException
SQLChar
getTime in interface DataValueDescriptorgetTime in class SQLCharcal - calendar for object creation
StandardException - thrown on failure to convertDataValueDescriptor.getTime(java.util.Calendar)
public java.sql.Timestamp getTimestamp(java.util.Calendar cal)
throws StandardException
SQLChar
getTimestamp in interface DataValueDescriptorgetTimestamp in class SQLCharcal - calendar for object creation
StandardException - thrown on failure to convertDataValueDescriptor.getTimestamp(java.util.Calendar)
public final java.lang.String getTraceString()
throws StandardException
getTraceString in interface DataValueDescriptorgetTraceString in class SQLCharStandardException - if getting the data value fails.DataValueDescriptor.getString()
public void normalize(DataTypeDescriptor desiredType,
DataValueDescriptor sourceValue)
throws StandardException
normalize in interface DataValueDescriptornormalize in class SQLVarchardesiredType - The type to normalize the source column tosourceValue - The value to normalize
StandardException - Thrown for null into
non-nullable column, and for
truncation error
public void setValue(java.sql.Time theValue,
java.util.Calendar cal)
throws StandardException
DataType
setValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The Time value to set this DataValueDescriptor tocal - The time zone from the calendar is used to construct the database time value
StandardException - Thrown on error
public void setValue(java.sql.Timestamp theValue,
java.util.Calendar cal)
throws StandardException
DataType
setValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The Timestamp value to set this DataValueDescriptor tocal - The time zone from the calendar is used to construct the database timestamp value
StandardException - Thrown on error
public void setValue(java.sql.Date theValue,
java.util.Calendar cal)
throws StandardException
DataType
setValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The Date value to set this DataValueDescriptor tocal - The time zone from the calendar is used to construct the database date value
StandardException - Thrown on error
public void setBigDecimal(java.lang.Number bigDecimal)
throws StandardException
SQLChar
setBigDecimal in interface DataValueDescriptorsetBigDecimal in class SQLCharbigDecimal - required to be a BigDecimal or null.
StandardExceptionpublic final void setStream(java.io.InputStream stream)
setStream in interface StreamStorablesetStream in class SQLCharstream - the new streampublic final void restoreToNull()
Storable
restoreToNull in interface StorablerestoreToNull in class SQLCharStorable.restoreToNull()
public void setValue(int theValue)
throws StandardException
DataType
setValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor to
StandardException - Thrown on error
public void setValue(double theValue)
throws StandardException
DataType
setValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor to
StandardException - Thrown on error
public void setValue(float theValue)
throws StandardException
DataType
setValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor to
StandardException - Thrown on error
public void setValue(short theValue)
throws StandardException
DataType
setValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor to
StandardException - Thrown on error
public void setValue(long theValue)
throws StandardException
DataType
setValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor to
StandardException - Thrown on error
public void setValue(byte theValue)
throws StandardException
DataType
setValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor to
StandardException - Thrown on error
public void setValue(boolean theValue)
throws StandardException
DataType
setValue in interface DataValueDescriptorsetValue in class SQLChartheValue - Contains the boolean value to set this to
StandardException
public void setValue(byte[] theValue)
throws StandardException
DataType
setValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The byte value to set this DataValueDescriptor to
StandardException
final void setObject(java.lang.Object theValue)
throws StandardException
setObject in class DataTypeStandardException
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.ExternalizablewriteExternal in class SQLCharout - destination stream
java.io.IOException - if writing to the destination stream failsDataInputStreampublic StreamHeaderGenerator getStreamHeaderGenerator()
NOTE: To guarantee a successful generation, one of the following two conditions must be met at header or EOF generation time:
setStreamHeaderFormat has been invoked before the header
generator was obtained.
getStreamHeaderGenerator in interface StringDataValuegetStreamHeaderGenerator in class SQLCharStringDataValue.setStreamHeaderFormat(java.lang.Boolean)public void setStreamHeaderFormat(java.lang.Boolean inSoftUpgradeMode)
setStreamHeaderFormat in interface StringDataValuesetStreamHeaderFormat in class SQLCharinSoftUpgradeMode - TRUE if the database is accessed in
soft upgrade mode, FALSE is not, or null if unknown
private SQLClob.HeaderInfo investigateHeader(byte[] hdr,
int bytesRead)
throws java.io.IOException
hdr - the raw header bytesbytesRead - number of bytes written into the raw header bytes array
java.io.IOException - if the header format is invalid, or the stream
seems to have been corrupted
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException
readExternal in interface java.io.ExternalizablereadExternal in class SQLCharin - source stream
java.io.UTFDataFormatException - if an encoding error is detected
java.io.IOException - if reading from the stream fails, or the content of
the stream header is invalid
public void readExternalFromArray(ArrayInputStream in)
throws java.io.IOException
readExternalFromArray in interface DataValueDescriptorreadExternalFromArray in class SQLCharin - source stream
java.io.UTFDataFormatException - if an encoding error is detected
java.io.IOException - if reading from the stream fails, or the content of
the stream header is invalidDataInputStream.readUnsignedShort(),
Externalizable.readExternal(java.io.ObjectInput)
private void rewindStream(java.io.InputStream in,
long offset)
throws java.io.IOException
in - input stream to rewindoffset - number of bytes to skip
java.io.IOException - if resetting or reading from the stream fails
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||