Class SQLClob
- java.lang.Object
-
- org.apache.derby.iapi.types.DataType
-
- org.apache.derby.iapi.types.SQLChar
-
- org.apache.derby.iapi.types.SQLVarchar
-
- org.apache.derby.iapi.types.SQLClob
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,java.lang.Comparable
,Formatable
,Storable
,StreamStorable
,TypedFormat
,ConcatableDataValue
,DataValueDescriptor
,Orderable
,StringDataValue
,VariableSizeDataValue
- Direct Known Subclasses:
CollatorSQLClob
public class SQLClob extends SQLVarchar
SQLClob represents a CLOB value with UCS_BASIC collation. CLOB supports LIKE operator only for collation.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
SQLClob.HeaderInfo
Holder class for header information gathered from the raw byte header in the stream.
-
Field Summary
Fields 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.-
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.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.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.VariableSizeDataValue
IGNORE_PRECISION
-
-
Method Summary
All Methods Instance Methods Concrete Methods 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 datatypeStringDataValue
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 overridevoid
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 overridevoid
setValue(float theValue)
Set the value of this DataValueDescriptor to the given float value At DataType level just throws an error lower classes will overridevoid
setValue(int theValue)
Set the value of this DataValueDescriptor to the given int value At DataType level just throws an error lower classes will overridevoid
setValue(long theValue)
Set the value of this DataValueDescriptor to the given long value At DataType level just throws an error lower classes will overridevoid
setValue(short theValue)
Set the value of this DataValueDescriptor to the given short value At DataType level just throws an error lower classes will overridevoid
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.-
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
-
-
-
-
Field Detail
-
TEN_FOUR_CLOB_HEADER_GENERATOR
private static final StreamHeaderGenerator TEN_FOUR_CLOB_HEADER_GENERATOR
The header generator used for 10.4 (or older) databases.
-
TEN_FIVE_CLOB_HEADER_GENERATOR
private static final StreamHeaderGenerator TEN_FIVE_CLOB_HEADER_GENERATOR
The header generator used for 10.5 databases.
-
MAX_STREAM_HEADER_LENGTH
private static final int MAX_STREAM_HEADER_LENGTH
The maximum number of bytes used by the stream header.Use the length specified by the ten five header generator.
-
csd
private CharacterStreamDescriptor csd
The descriptor for the stream. If there is no stream this should benull
, which is also true if the descriptor hasen't been constructed yet. Note: Always check ifstream
is non-null before using the information stored in the descriptor internally.
-
inSoftUpgradeMode
private java.lang.Boolean inSoftUpgradeMode
Tells if the database is being accessed in soft upgrade mode.
-
-
Method Detail
-
getTypeName
public java.lang.String getTypeName()
Description copied from interface:DataValueDescriptor
Get the SQL name of the datatype- Specified by:
getTypeName
in interfaceDataValueDescriptor
- Overrides:
getTypeName
in classSQLVarchar
- Returns:
- The SQL name of the datatype
-
cloneValue
public DataValueDescriptor cloneValue(boolean forceMaterialization)
Returns a clone of this CLOB value.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.
- Specified by:
cloneValue
in interfaceDataValueDescriptor
- Overrides:
cloneValue
in classSQLVarchar
- Parameters:
forceMaterialization
- any streams representing the data value will be materialized iftrue
, the data value will be kept as a stream if possible iffalse
- Returns:
- A clone of this CLOB value.
- See Also:
DataValueDescriptor.cloneValue(boolean)
-
getNewNull
public DataValueDescriptor getNewNull()
Description copied from interface:DataValueDescriptor
Get a new null value of the same type as this data value.- Specified by:
getNewNull
in interfaceDataValueDescriptor
- Overrides:
getNewNull
in classSQLVarchar
- See Also:
DataValueDescriptor.getNewNull()
-
getValue
public StringDataValue getValue(java.text.RuleBasedCollator collatorForComparison)
Description copied from interface:StringDataValue
Gets either SQLChar/SQLVarchar/SQLLongvarchar/SQLClob(base classes) or CollatorSQLChar/CollatorSQLVarchar/CollatorSQLLongvarch/CollatorSQLClob (subclasses). Whether this method returns the base class or the subclass depends on the value of the RuleBasedCollator. If RuleBasedCollator is null, then the object returned would be baseclass otherwise it would be subcalss.- Specified by:
getValue
in interfaceStringDataValue
- Overrides:
getValue
in classSQLVarchar
- See Also:
StringDataValue.getValue(RuleBasedCollator)
-
getTypeFormatId
public int getTypeFormatId()
Return my format identifier.- Specified by:
getTypeFormatId
in interfaceTypedFormat
- Overrides:
getTypeFormatId
in classSQLVarchar
- Returns:
- The identifier. (A UUID stuffed in an array of 16 bytes).
- See Also:
TypedFormat.getTypeFormatId()
-
typePrecedence
public int typePrecedence()
Description copied from class:DataType
Each built-in type in JSQL has a precedence. This precedence determines how to do type promotion when using binary operators. For example, float has a higher precedence than int, so when adding an int to a float, the result type is float. The precedence for some types is arbitrary. For example, it doesn't matter what the precedence of the boolean type is, since it can't be mixed with other types. But the precedence for the number types is critical. The SQL standard requires that exact numeric types be promoted to approximate numeric when one operator uses both. Also, the precedence is arranged so that one will not lose precision when promoting a type.- Specified by:
typePrecedence
in interfaceDataValueDescriptor
- Overrides:
typePrecedence
in classSQLVarchar
- Returns:
- The precedence of this type.
- See Also:
DataValueDescriptor.typePrecedence()
-
getBoolean
public boolean getBoolean() throws StandardException
Description copied from class:SQLChar
Get Boolean from a SQLChar.Return false for only "0" or "false" for false. No case insensitivity. Everything else is true.
The above matches JCC and the client driver.
- Specified by:
getBoolean
in interfaceDataValueDescriptor
- Overrides:
getBoolean
in classSQLChar
- Returns:
- The data value as a boolean.
- Throws:
StandardException
- Thrown on error- See Also:
DataValueDescriptor.getBoolean()
-
getByte
public byte getByte() throws StandardException
Description copied from class:SQLChar
Get Byte from a SQLChar.Uses java standard Byte.parseByte() to perform coercion.
- Specified by:
getByte
in interfaceDataValueDescriptor
- Overrides:
getByte
in classSQLChar
- Returns:
- The data value as a byte.
- Throws:
StandardException
- thrown on failure to convert- See Also:
DataValueDescriptor.getByte()
-
getShort
public short getShort() throws StandardException
Description copied from class:SQLChar
Get Short from a SQLChar.Uses java standard Short.parseShort() to perform coercion.
- Specified by:
getShort
in interfaceDataValueDescriptor
- Overrides:
getShort
in classSQLChar
- Returns:
- The data value as a short.
- Throws:
StandardException
- thrown on failure to convert- See Also:
DataValueDescriptor.getShort()
-
getInt
public int getInt() throws StandardException
Description copied from class:SQLChar
Get int from a SQLChar.Uses java standard Short.parseInt() to perform coercion.
- Specified by:
getInt
in interfaceDataValueDescriptor
- Overrides:
getInt
in classSQLChar
- Returns:
- The data value as a int.
- Throws:
StandardException
- thrown on failure to convert- See Also:
DataValueDescriptor.getInt()
-
getLength
public int getLength() throws StandardException
Returns the character length of this Clob.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.
- Specified by:
getLength
in interfaceDataValueDescriptor
- Overrides:
getLength
in classSQLChar
- Returns:
- The character length of this Clob.
- Throws:
StandardException
- if obtaining the length fails
-
getLong
public long getLong() throws StandardException
Description copied from class:SQLChar
Get long from a SQLChar.Uses java standard Short.parseLong() to perform coercion.
- Specified by:
getLong
in interfaceDataValueDescriptor
- Overrides:
getLong
in classSQLChar
- Returns:
- The data value as a long.
- Throws:
StandardException
- thrown on failure to convert- See Also:
DataValueDescriptor.getLong()
-
getFloat
public float getFloat() throws StandardException
Description copied from class:SQLChar
Get float from a SQLChar.Uses java standard Float.floatValue() to perform coercion.
- Specified by:
getFloat
in interfaceDataValueDescriptor
- Overrides:
getFloat
in classSQLChar
- Returns:
- The data value as a float.
- Throws:
StandardException
- thrown on failure to convert- See Also:
DataValueDescriptor.getFloat()
-
getDouble
public double getDouble() throws StandardException
Description copied from class:SQLChar
Get double from a SQLChar.Uses java standard Double.doubleValue() to perform coercion.
- Specified by:
getDouble
in interfaceDataValueDescriptor
- Overrides:
getDouble
in classSQLChar
- Returns:
- The data value as a double.
- Throws:
StandardException
- thrown on failure to convert- See Also:
DataValueDescriptor.getDouble()
-
typeToBigDecimal
public int typeToBigDecimal() throws StandardException
Description copied from class:SQLChar
CHAR/VARCHAR/LONG VARCHAR implementation. Convert to a BigDecimal using getString.- Specified by:
typeToBigDecimal
in interfaceDataValueDescriptor
- Overrides:
typeToBigDecimal
in classSQLChar
- Returns:
- Types.CHAR for String conversion through getString Types.DECIMAL for BigDecimal through getObject or Types.BIGINT for long conversion through getLong
- Throws:
StandardException
- Conversion is not possible
-
getBytes
public byte[] getBytes() throws StandardException
Description copied from class:DataType
Gets the value in the data value descriptor as a byte[]. Throws an exception if the data value is not receivable as a Binary or Varbinary.- Specified by:
getBytes
in interfaceDataValueDescriptor
- Overrides:
getBytes
in classDataType
- Returns:
- The Binary value as a byte[].
- Throws:
StandardException
- Thrown on error
-
getDate
public java.sql.Date getDate(java.util.Calendar cal) throws StandardException
Description copied from class:SQLChar
Get date from a SQLChar.- Specified by:
getDate
in interfaceDataValueDescriptor
- Overrides:
getDate
in classSQLChar
- Parameters:
cal
- calendar for object creation- Returns:
- The data value as a java.sql.Date.
- Throws:
StandardException
- thrown on failure to convert- See Also:
DataValueDescriptor.getDate(java.util.Calendar)
-
getObject
public java.lang.Object getObject() throws StandardException
Description copied from class:DataType
Gets the value in the data value descriptor as a int. Throws an exception if the data value is not receivable as a int.- Specified by:
getObject
in interfaceDataValueDescriptor
- Overrides:
getObject
in classSQLChar
- Returns:
- The data value as a int.
- Throws:
StandardException
- Thrown on error
-
getStreamWithDescriptor
public CharacterStreamDescriptor getStreamWithDescriptor() throws StandardException
Returns a descriptor for the input stream for this CLOB value.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.
- Specified by:
getStreamWithDescriptor
in interfaceStringDataValue
- Overrides:
getStreamWithDescriptor
in classSQLChar
- Returns:
- A descriptor for the stream, which includes a reference to the
stream itself. If the value cannot be represented as a stream,
null
is returned instead of a descriptor. - Throws:
StandardException
- if obtaining the descriptor fails- See Also:
getStreamWithDescriptor()
-
hasStream
public boolean hasStream()
Tells if this CLOB value is, or will be, represented by a stream.- Specified by:
hasStream
in interfaceDataValueDescriptor
- Overrides:
hasStream
in classDataType
- Returns:
true
if the value is represented by a stream,false
otherwise.- See Also:
DataValueDescriptor.getStream()
,StringDataValue.getStreamWithDescriptor()
-
getTime
public java.sql.Time getTime(java.util.Calendar cal) throws StandardException
Description copied from class:SQLChar
Get time from a SQLChar.- Specified by:
getTime
in interfaceDataValueDescriptor
- Overrides:
getTime
in classSQLChar
- Parameters:
cal
- calendar for object creation- Returns:
- The data value as a java.sql.Time.
- Throws:
StandardException
- thrown on failure to convert- See Also:
DataValueDescriptor.getTime(java.util.Calendar)
-
getTimestamp
public java.sql.Timestamp getTimestamp(java.util.Calendar cal) throws StandardException
Description copied from class:SQLChar
Get Timestamp from a SQLChar.- Specified by:
getTimestamp
in interfaceDataValueDescriptor
- Overrides:
getTimestamp
in classSQLChar
- Parameters:
cal
- calendar for object creation- Returns:
- The data value as a java.sql.Timestamp.
- Throws:
StandardException
- thrown on failure to convert- See Also:
DataValueDescriptor.getTimestamp(java.util.Calendar)
-
getTraceString
public final java.lang.String getTraceString() throws StandardException
Gets a trace representation of the CLOB for debugging.- Specified by:
getTraceString
in interfaceDataValueDescriptor
- Overrides:
getTraceString
in classSQLChar
- Returns:
- a trace representation of the CLOB.
- Throws:
StandardException
- if getting the data value fails.- See Also:
DataValueDescriptor.getString()
-
normalize
public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor sourceValue) throws StandardException
Normalization method - this method may be called when putting a value into a SQLClob, for example, when inserting into a SQLClob column. See NormalizeResultSet in execution. Per the SQL standard ,if the clob column is not big enough to hold the value being inserted,truncation error will result if there are trailing non-blanks. Truncation of trailing blanks is allowed.- Specified by:
normalize
in interfaceDataValueDescriptor
- Overrides:
normalize
in classSQLVarchar
- Parameters:
desiredType
- The type to normalize the source column tosourceValue
- The value to normalize- Throws:
StandardException
- Thrown for null into non-nullable column, and for truncation error
-
setValue
public void setValue(java.sql.Time theValue, java.util.Calendar cal) throws StandardException
Description copied from class:DataType
Set the value of this DataValueDescriptor. At DataType level just throws an error lower classes will override- Specified by:
setValue
in interfaceDataValueDescriptor
- Overrides:
setValue
in classSQLChar
- Parameters:
theValue
- The Time value to set this DataValueDescriptor tocal
- The time zone from the calendar is used to construct the database time value- Throws:
StandardException
- Thrown on error
-
setValue
public void setValue(java.sql.Timestamp theValue, java.util.Calendar cal) throws StandardException
Description copied from class:DataType
Set the value of this DataValueDescriptor. At DataType level just throws an error lower classes will override- Specified by:
setValue
in interfaceDataValueDescriptor
- Overrides:
setValue
in classSQLChar
- Parameters:
theValue
- The Timestamp value to set this DataValueDescriptor tocal
- The time zone from the calendar is used to construct the database timestamp value- Throws:
StandardException
- Thrown on error
-
setValue
public void setValue(java.sql.Date theValue, java.util.Calendar cal) throws StandardException
Description copied from class:DataType
Set the value of this DataValueDescriptor. At DataType level just throws an error lower classes will override- Specified by:
setValue
in interfaceDataValueDescriptor
- Overrides:
setValue
in classSQLChar
- Parameters:
theValue
- The Date value to set this DataValueDescriptor tocal
- The time zone from the calendar is used to construct the database date value- Throws:
StandardException
- Thrown on error
-
setBigDecimal
public void setBigDecimal(java.math.BigDecimal bigDecimal) throws StandardException
Description copied from class:SQLChar
Only to be called when an application through JDBC is setting a SQLChar to a java.math.BigDecimal.- Specified by:
setBigDecimal
in interfaceDataValueDescriptor
- Overrides:
setBigDecimal
in classSQLChar
- Parameters:
bigDecimal
- required to be a BigDecimal or null.- Throws:
StandardException
-
setStream
public final void setStream(java.io.InputStream stream)
Sets a new stream for this CLOB.- Specified by:
setStream
in interfaceStreamStorable
- Overrides:
setStream
in classSQLChar
- Parameters:
stream
- the new stream
-
restoreToNull
public final void restoreToNull()
Description copied from interface:Storable
Restore this object to its (SQL)null value.- Specified by:
restoreToNull
in interfaceStorable
- Overrides:
restoreToNull
in classSQLChar
- See Also:
Storable.restoreToNull()
-
setValue
public void setValue(int theValue) throws StandardException
Description copied from class:DataType
Set the value of this DataValueDescriptor to the given int value At DataType level just throws an error lower classes will override- Specified by:
setValue
in interfaceDataValueDescriptor
- Overrides:
setValue
in classSQLChar
- Parameters:
theValue
- The value to set this DataValueDescriptor to- Throws:
StandardException
- Thrown on error
-
setValue
public void setValue(double theValue) throws StandardException
Description copied from class:DataType
Set the value of this DataValueDescriptor to the given double value At DataType level just throws an error lower classes will override- Specified by:
setValue
in interfaceDataValueDescriptor
- Overrides:
setValue
in classSQLChar
- Parameters:
theValue
- The value to set this DataValueDescriptor to- Throws:
StandardException
- Thrown on error
-
setValue
public void setValue(float theValue) throws StandardException
Description copied from class:DataType
Set the value of this DataValueDescriptor to the given float value At DataType level just throws an error lower classes will override- Specified by:
setValue
in interfaceDataValueDescriptor
- Overrides:
setValue
in classSQLChar
- Parameters:
theValue
- The value to set this DataValueDescriptor to- Throws:
StandardException
- Thrown on error
-
setValue
public void setValue(short theValue) throws StandardException
Description copied from class:DataType
Set the value of this DataValueDescriptor to the given short value At DataType level just throws an error lower classes will override- Specified by:
setValue
in interfaceDataValueDescriptor
- Overrides:
setValue
in classSQLChar
- Parameters:
theValue
- The value to set this DataValueDescriptor to- Throws:
StandardException
- Thrown on error
-
setValue
public void setValue(long theValue) throws StandardException
Description copied from class:DataType
Set the value of this DataValueDescriptor to the given long value At DataType level just throws an error lower classes will override- Specified by:
setValue
in interfaceDataValueDescriptor
- Overrides:
setValue
in classSQLChar
- Parameters:
theValue
- The value to set this DataValueDescriptor to- Throws:
StandardException
- Thrown on error
-
setValue
public void setValue(byte theValue) throws StandardException
Description copied from class:DataType
Set the value of this DataValueDescriptor to the given byte value At DataType level just throws an error lower classes will override- Specified by:
setValue
in interfaceDataValueDescriptor
- Overrides:
setValue
in classSQLChar
- Parameters:
theValue
- The value to set this DataValueDescriptor to- Throws:
StandardException
- Thrown on error
-
setValue
public void setValue(boolean theValue) throws StandardException
Description copied from class:DataType
Set the value. At DataType level just throws an error lower classes will override- Specified by:
setValue
in interfaceDataValueDescriptor
- Overrides:
setValue
in classSQLChar
- Parameters:
theValue
- Contains the boolean value to set this to- Throws:
StandardException
-
setValue
public void setValue(byte[] theValue) throws StandardException
Description copied from class:DataType
Set the value of this DataValueDescriptor. At DataType level just throws an error lower classes will override- Specified by:
setValue
in interfaceDataValueDescriptor
- Overrides:
setValue
in classSQLChar
- Parameters:
theValue
- The byte value to set this DataValueDescriptor to- Throws:
StandardException
-
setObject
final void setObject(java.lang.Object theValue) throws StandardException
Set the value from an non-null Java.sql.Clob object.- Overrides:
setObject
in classDataType
- Throws:
StandardException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
Writes the CLOB data value to the given destination stream using the modified UTF-8 format.- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Overrides:
writeExternal
in classSQLChar
- Parameters:
out
- destination stream- Throws:
java.io.IOException
- if writing to the destination stream fails- See Also:
DataInputStream
-
getStreamHeaderGenerator
public StreamHeaderGenerator getStreamHeaderGenerator()
Returns a stream header generator for a Clob.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.- There is context at generation time, such that the mode can be determined by obtaining the database context and by consulting the data dictionary.
- Specified by:
getStreamHeaderGenerator
in interfaceStringDataValue
- Overrides:
getStreamHeaderGenerator
in classSQLChar
- Returns:
- A stream header generator.
- See Also:
StringDataValue.setStreamHeaderFormat(java.lang.Boolean)
-
setStreamHeaderFormat
public void setStreamHeaderFormat(java.lang.Boolean inSoftUpgradeMode)
Tells whether the database is being accessed in soft upgrade mode or not.- Specified by:
setStreamHeaderFormat
in interfaceStringDataValue
- Overrides:
setStreamHeaderFormat
in classSQLChar
- Parameters:
inSoftUpgradeMode
-TRUE
if the database is accessed in soft upgrade mode,FALSE
is not, ornull
if unknown
-
investigateHeader
private SQLClob.HeaderInfo investigateHeader(byte[] hdr, int bytesRead) throws java.io.IOException
Investigates the header and returns length information.- Parameters:
hdr
- the raw header bytesbytesRead
- number of bytes written into the raw header bytes array- Returns:
- The information obtained from the header.
- Throws:
java.io.IOException
- if the header format is invalid, or the stream seems to have been corrupted
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException
Reads and materializes the CLOB value from the stream.- Specified by:
readExternal
in interfacejava.io.Externalizable
- Overrides:
readExternal
in classSQLChar
- Parameters:
in
- source stream- Throws:
java.io.UTFDataFormatException
- if an encoding error is detectedjava.io.IOException
- if reading from the stream fails, or the content of the stream header is invalid
-
readExternalFromArray
public void readExternalFromArray(ArrayInputStream in) throws java.io.IOException
Reads and materializes the CLOB value from the stream.- Specified by:
readExternalFromArray
in interfaceDataValueDescriptor
- Overrides:
readExternalFromArray
in classSQLChar
- Parameters:
in
- source stream- Throws:
java.io.UTFDataFormatException
- if an encoding error is detectedjava.io.IOException
- if reading from the stream fails, or the content of the stream header is invalid- See Also:
DataInputStream.readUnsignedShort()
,Externalizable.readExternal(java.io.ObjectInput)
-
rewindStream
private void rewindStream(java.io.InputStream in, long offset) throws java.io.IOException
Rewinds the stream to the beginning and then skips the specified number of bytes.- Parameters:
in
- input stream to rewindoffset
- number of bytes to skip- Throws:
java.io.IOException
- if resetting or reading from the stream fails
-
-