java.io.Externalizable, java.io.Serializable, java.lang.Comparable, Formatable, Storable, StreamStorable, TypedFormat, ConcatableDataValue, DataValueDescriptor, Orderable, StringDataValue, VariableSizeDataValueCollatorSQLClobpublic class SQLClob extends SQLVarchar
| Modifier and Type | Class | Description |
|---|---|---|
private static class |
SQLClob.HeaderInfo |
Holder class for header information gathered from the raw byte header in
the stream.
|
| Modifier and Type | Field | Description |
|---|---|---|
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.
|
UNKNOWN_LOGICAL_LENGTHORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN_clobValue, arg_passer, CHAR_HEADER_GENERATOR, RETURN_SPACE_THRESHOLD, streamBOTH, 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, TRAILINGIGNORE_PRECISION| Constructor | Description |
|---|---|
SQLClob() |
|
SQLClob(java.lang.String val) |
|
SQLClob(java.sql.Clob val) |
| Modifier and Type | Method | Description |
|---|---|---|
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.math.BigDecimal 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(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.Date theValue,
java.util.Calendar cal) |
Set the value of this DataValueDescriptor.
|
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.
|
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, throwLangSetMismatchcheckHostVariable, coalesce, compare, compare, in, isNotNull, isNullOp, recycle, setInto, setToNull, setValue, setValue, setValue, setValue, setValue, setValueclone, finalize, getClass, notify, notifyAll, wait, wait, waitansiTrim, 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, zeroRawDatagrowBy, normalizeprivate 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
public SQLClob()
public SQLClob(java.lang.String val)
public SQLClob(java.sql.Clob val)
public java.lang.String getTypeName()
DataValueDescriptorgetTypeName 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 falseDataValueDescriptor.cloneValue(boolean)public DataValueDescriptor getNewNull()
DataValueDescriptorgetNewNull in interface DataValueDescriptorgetNewNull in class SQLVarcharDataValueDescriptor.getNewNull()public StringDataValue getValue(java.text.RuleBasedCollator collatorForComparison)
StringDataValuegetValue in interface StringDataValuegetValue in class SQLVarcharStringDataValue.getValue(RuleBasedCollator)public int getTypeFormatId()
getTypeFormatId in interface TypedFormatgetTypeFormatId in class SQLVarcharTypedFormat.getTypeFormatId()public int typePrecedence()
DataTypetypePrecedence 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 failspublic 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
SQLChartypeToBigDecimal in interface DataValueDescriptortypeToBigDecimal in class SQLCharStandardException - Conversion is not possiblepublic byte[] getBytes()
throws StandardException
DataTypegetBytes in interface DataValueDescriptorgetBytes in class DataTypeStandardException - Thrown on errorpublic java.sql.Date getDate(java.util.Calendar cal)
throws StandardException
SQLChargetDate in interface DataValueDescriptorgetDate in class SQLCharcal - calendar for object creationStandardException - thrown on failure to convertDataValueDescriptor.getDate(java.util.Calendar)public java.lang.Object getObject()
throws StandardException
DataTypegetObject in interface DataValueDescriptorgetObject in class SQLCharStandardException - Thrown on errorpublic 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
SQLChargetTime in interface DataValueDescriptorgetTime in class SQLCharcal - calendar for object creationStandardException - thrown on failure to convertDataValueDescriptor.getTime(java.util.Calendar)public java.sql.Timestamp getTimestamp(java.util.Calendar cal)
throws StandardException
SQLChargetTimestamp in interface DataValueDescriptorgetTimestamp in class SQLCharcal - calendar for object creationStandardException - 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 normalizeStandardException - Thrown for null into
non-nullable column, and for
truncation errorpublic void setValue(java.sql.Time theValue,
java.util.Calendar cal)
throws StandardException
DataTypesetValue 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 valueStandardException - Thrown on errorpublic void setValue(java.sql.Timestamp theValue,
java.util.Calendar cal)
throws StandardException
DataTypesetValue 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 valueStandardException - Thrown on errorpublic void setValue(java.sql.Date theValue,
java.util.Calendar cal)
throws StandardException
DataTypesetValue 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 valueStandardException - Thrown on errorpublic void setBigDecimal(java.math.BigDecimal bigDecimal)
throws StandardException
SQLCharsetBigDecimal 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()
StorablerestoreToNull in interface StorablerestoreToNull in class SQLCharStorable.restoreToNull()public void setValue(int theValue)
throws StandardException
DataTypesetValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor toStandardException - Thrown on errorpublic void setValue(double theValue)
throws StandardException
DataTypesetValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor toStandardException - Thrown on errorpublic void setValue(float theValue)
throws StandardException
DataTypesetValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor toStandardException - Thrown on errorpublic void setValue(short theValue)
throws StandardException
DataTypesetValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor toStandardException - Thrown on errorpublic void setValue(long theValue)
throws StandardException
DataTypesetValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor toStandardException - Thrown on errorpublic void setValue(byte theValue)
throws StandardException
DataTypesetValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The value to set this DataValueDescriptor toStandardException - Thrown on errorpublic void setValue(boolean theValue)
throws StandardException
DataTypesetValue in interface DataValueDescriptorsetValue in class SQLChartheValue - Contains the boolean value to set this toStandardExceptionpublic void setValue(byte[] theValue)
throws StandardException
DataTypesetValue in interface DataValueDescriptorsetValue in class SQLChartheValue - The byte value to set this DataValueDescriptor toStandardExceptionfinal void setObject(java.lang.Object theValue)
throws StandardException
setObject in class DataTypeStandardExceptionpublic void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.ExternalizablewriteExternal in class SQLCharout - destination streamjava.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 unknownprivate 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 arrayjava.io.IOException - if the header format is invalid, or the stream
seems to have been corruptedpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException
readExternal in interface java.io.ExternalizablereadExternal in class SQLCharin - source streamjava.io.UTFDataFormatException - if an encoding error is detectedjava.io.IOException - if reading from the stream fails, or the content of
the stream header is invalidpublic void readExternalFromArray(ArrayInputStream in) throws java.io.IOException
readExternalFromArray in interface DataValueDescriptorreadExternalFromArray in class SQLCharin - source streamjava.io.UTFDataFormatException - if an encoding error is detectedjava.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 skipjava.io.IOException - if resetting or reading from the stream failsApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.