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 classSQLClob.HeaderInfoHolder class for header information gathered from the raw byte header in the stream.
-
Field Summary
Fields Modifier and Type Field Description private CharacterStreamDescriptorcsdThe descriptor for the stream.private java.lang.BooleaninSoftUpgradeModeTells if the database is being accessed in soft upgrade mode.private static intMAX_STREAM_HEADER_LENGTHThe maximum number of bytes used by the stream header.private static StreamHeaderGeneratorTEN_FIVE_CLOB_HEADER_GENERATORThe header generator used for 10.5 databases.private static StreamHeaderGeneratorTEN_FOUR_CLOB_HEADER_GENERATORThe 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 DataValueDescriptorcloneValue(boolean forceMaterialization)Returns a clone of this CLOB value.booleangetBoolean()Get Boolean from a SQLChar.bytegetByte()Get Byte from a SQLChar.byte[]getBytes()Gets the value in the data value descriptor as a byte[].java.sql.DategetDate(java.util.Calendar cal)Get date from a SQLChar.doublegetDouble()Get double from a SQLChar.floatgetFloat()Get float from a SQLChar.intgetInt()Get int from a SQLChar.intgetLength()Returns the character length of this Clob.longgetLong()Get long from a SQLChar.DataValueDescriptorgetNewNull()Get a new null value of the same type as this data value.java.lang.ObjectgetObject()Gets the value in the data value descriptor as a int.shortgetShort()Get Short from a SQLChar.StreamHeaderGeneratorgetStreamHeaderGenerator()Returns a stream header generator for a Clob.CharacterStreamDescriptorgetStreamWithDescriptor()Returns a descriptor for the input stream for this CLOB value.java.sql.TimegetTime(java.util.Calendar cal)Get time from a SQLChar.java.sql.TimestampgetTimestamp(java.util.Calendar cal)Get Timestamp from a SQLChar.java.lang.StringgetTraceString()Gets a trace representation of the CLOB for debugging.intgetTypeFormatId()Return my format identifier.java.lang.StringgetTypeName()Get the SQL name of the datatypeStringDataValuegetValue(java.text.RuleBasedCollator collatorForComparison)Gets either SQLChar/SQLVarchar/SQLLongvarchar/SQLClob(base classes) or CollatorSQLChar/CollatorSQLVarchar/CollatorSQLLongvarch/CollatorSQLClob (subclasses).booleanhasStream()Tells if this CLOB value is, or will be, represented by a stream.private SQLClob.HeaderInfoinvestigateHeader(byte[] hdr, int bytesRead)Investigates the header and returns length information.voidnormalize(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.voidreadExternal(java.io.ObjectInput in)Reads and materializes the CLOB value from the stream.voidreadExternalFromArray(ArrayInputStream in)Reads and materializes the CLOB value from the stream.voidrestoreToNull()Restore this object to its (SQL)null value.private voidrewindStream(java.io.InputStream in, long offset)Rewinds the stream to the beginning and then skips the specified number of bytes.voidsetBigDecimal(java.math.BigDecimal bigDecimal)Only to be called when an application through JDBC is setting a SQLChar to a java.math.BigDecimal.(package private) voidsetObject(java.lang.Object theValue)Set the value from an non-null Java.sql.Clob object.voidsetStream(java.io.InputStream stream)Sets a new stream for this CLOB.voidsetStreamHeaderFormat(java.lang.Boolean inSoftUpgradeMode)Tells whether the database is being accessed in soft upgrade mode or not.voidsetValue(boolean theValue)Set the value.voidsetValue(byte theValue)Set the value of this DataValueDescriptor to the given byte value At DataType level just throws an error lower classes will overridevoidsetValue(byte[] theValue)Set the value of this DataValueDescriptor.voidsetValue(double theValue)Set the value of this DataValueDescriptor to the given double value At DataType level just throws an error lower classes will overridevoidsetValue(float theValue)Set the value of this DataValueDescriptor to the given float value At DataType level just throws an error lower classes will overridevoidsetValue(int theValue)Set the value of this DataValueDescriptor to the given int value At DataType level just throws an error lower classes will overridevoidsetValue(long theValue)Set the value of this DataValueDescriptor to the given long value At DataType level just throws an error lower classes will overridevoidsetValue(short theValue)Set the value of this DataValueDescriptor to the given short value At DataType level just throws an error lower classes will overridevoidsetValue(java.sql.Date theValue, java.util.Calendar cal)Set the value of this DataValueDescriptor.voidsetValue(java.sql.Time theValue, java.util.Calendar cal)Set the value of this DataValueDescriptor.voidsetValue(java.sql.Timestamp theValue, java.util.Calendar cal)Set the value of this DataValueDescriptor.inttypePrecedence()Each built-in type in JSQL has a precedence.inttypeToBigDecimal()CHAR/VARCHAR/LONG VARCHAR implementation.voidwriteExternal(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 ifstreamis 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:DataValueDescriptorGet the SQL name of the datatype- Specified by:
getTypeNamein interfaceDataValueDescriptor- Overrides:
getTypeNamein 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:
cloneValuein interfaceDataValueDescriptor- Overrides:
cloneValuein 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:DataValueDescriptorGet a new null value of the same type as this data value.- Specified by:
getNewNullin interfaceDataValueDescriptor- Overrides:
getNewNullin classSQLVarchar- See Also:
DataValueDescriptor.getNewNull()
-
getValue
public StringDataValue getValue(java.text.RuleBasedCollator collatorForComparison)
Description copied from interface:StringDataValueGets 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:
getValuein interfaceStringDataValue- Overrides:
getValuein classSQLVarchar- See Also:
StringDataValue.getValue(RuleBasedCollator)
-
getTypeFormatId
public int getTypeFormatId()
Return my format identifier.- Specified by:
getTypeFormatIdin interfaceTypedFormat- Overrides:
getTypeFormatIdin 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:DataTypeEach 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:
typePrecedencein interfaceDataValueDescriptor- Overrides:
typePrecedencein classSQLVarchar- Returns:
- The precedence of this type.
- See Also:
DataValueDescriptor.typePrecedence()
-
getBoolean
public boolean getBoolean() throws StandardExceptionDescription copied from class:SQLCharGet 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:
getBooleanin interfaceDataValueDescriptor- Overrides:
getBooleanin classSQLChar- Returns:
- The data value as a boolean.
- Throws:
StandardException- Thrown on error- See Also:
DataValueDescriptor.getBoolean()
-
getByte
public byte getByte() throws StandardExceptionDescription copied from class:SQLCharGet Byte from a SQLChar.Uses java standard Byte.parseByte() to perform coercion.
- Specified by:
getBytein interfaceDataValueDescriptor- Overrides:
getBytein classSQLChar- Returns:
- The data value as a byte.
- Throws:
StandardException- thrown on failure to convert- See Also:
DataValueDescriptor.getByte()
-
getShort
public short getShort() throws StandardExceptionDescription copied from class:SQLCharGet Short from a SQLChar.Uses java standard Short.parseShort() to perform coercion.
- Specified by:
getShortin interfaceDataValueDescriptor- Overrides:
getShortin classSQLChar- Returns:
- The data value as a short.
- Throws:
StandardException- thrown on failure to convert- See Also:
DataValueDescriptor.getShort()
-
getInt
public int getInt() throws StandardExceptionDescription copied from class:SQLCharGet int from a SQLChar.Uses java standard Short.parseInt() to perform coercion.
- Specified by:
getIntin interfaceDataValueDescriptor- Overrides:
getIntin classSQLChar- Returns:
- The data value as a int.
- Throws:
StandardException- thrown on failure to convert- See Also:
DataValueDescriptor.getInt()
-
getLength
public int getLength() throws StandardExceptionReturns 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:
getLengthin interfaceDataValueDescriptor- Overrides:
getLengthin classSQLChar- Returns:
- The character length of this Clob.
- Throws:
StandardException- if obtaining the length fails
-
getLong
public long getLong() throws StandardExceptionDescription copied from class:SQLCharGet long from a SQLChar.Uses java standard Short.parseLong() to perform coercion.
- Specified by:
getLongin interfaceDataValueDescriptor- Overrides:
getLongin classSQLChar- Returns:
- The data value as a long.
- Throws:
StandardException- thrown on failure to convert- See Also:
DataValueDescriptor.getLong()
-
getFloat
public float getFloat() throws StandardExceptionDescription copied from class:SQLCharGet float from a SQLChar.Uses java standard Float.floatValue() to perform coercion.
- Specified by:
getFloatin interfaceDataValueDescriptor- Overrides:
getFloatin classSQLChar- Returns:
- The data value as a float.
- Throws:
StandardException- thrown on failure to convert- See Also:
DataValueDescriptor.getFloat()
-
getDouble
public double getDouble() throws StandardExceptionDescription copied from class:SQLCharGet double from a SQLChar.Uses java standard Double.doubleValue() to perform coercion.
- Specified by:
getDoublein interfaceDataValueDescriptor- Overrides:
getDoublein classSQLChar- Returns:
- The data value as a double.
- Throws:
StandardException- thrown on failure to convert- See Also:
DataValueDescriptor.getDouble()
-
typeToBigDecimal
public int typeToBigDecimal() throws StandardExceptionDescription copied from class:SQLCharCHAR/VARCHAR/LONG VARCHAR implementation. Convert to a BigDecimal using getString.- Specified by:
typeToBigDecimalin interfaceDataValueDescriptor- Overrides:
typeToBigDecimalin 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 StandardExceptionDescription copied from class:DataTypeGets 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:
getBytesin interfaceDataValueDescriptor- Overrides:
getBytesin classDataType- Returns:
- The Binary value as a byte[].
- Throws:
StandardException- Thrown on error
-
getDate
public java.sql.Date getDate(java.util.Calendar cal) throws StandardExceptionDescription copied from class:SQLCharGet date from a SQLChar.- Specified by:
getDatein interfaceDataValueDescriptor- Overrides:
getDatein 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 StandardExceptionDescription copied from class:DataTypeGets 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:
getObjectin interfaceDataValueDescriptor- Overrides:
getObjectin 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:
getStreamWithDescriptorin interfaceStringDataValue- Overrides:
getStreamWithDescriptorin classSQLChar- Returns:
- A descriptor for the stream, which includes a reference to the
stream itself. If the value cannot be represented as a stream,
nullis 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:
hasStreamin interfaceDataValueDescriptor- Overrides:
hasStreamin classDataType- Returns:
trueif the value is represented by a stream,falseotherwise.- See Also:
DataValueDescriptor.getStream(),StringDataValue.getStreamWithDescriptor()
-
getTime
public java.sql.Time getTime(java.util.Calendar cal) throws StandardExceptionDescription copied from class:SQLCharGet time from a SQLChar.- Specified by:
getTimein interfaceDataValueDescriptor- Overrides:
getTimein 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 StandardExceptionDescription copied from class:SQLCharGet Timestamp from a SQLChar.- Specified by:
getTimestampin interfaceDataValueDescriptor- Overrides:
getTimestampin 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 StandardExceptionGets a trace representation of the CLOB for debugging.- Specified by:
getTraceStringin interfaceDataValueDescriptor- Overrides:
getTraceStringin 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:
normalizein interfaceDataValueDescriptor- Overrides:
normalizein 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 StandardExceptionDescription copied from class:DataTypeSet the value of this DataValueDescriptor. At DataType level just throws an error lower classes will override- Specified by:
setValuein interfaceDataValueDescriptor- Overrides:
setValuein 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 StandardExceptionDescription copied from class:DataTypeSet the value of this DataValueDescriptor. At DataType level just throws an error lower classes will override- Specified by:
setValuein interfaceDataValueDescriptor- Overrides:
setValuein 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 StandardExceptionDescription copied from class:DataTypeSet the value of this DataValueDescriptor. At DataType level just throws an error lower classes will override- Specified by:
setValuein interfaceDataValueDescriptor- Overrides:
setValuein 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 StandardExceptionDescription copied from class:SQLCharOnly to be called when an application through JDBC is setting a SQLChar to a java.math.BigDecimal.- Specified by:
setBigDecimalin interfaceDataValueDescriptor- Overrides:
setBigDecimalin 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:
setStreamin interfaceStreamStorable- Overrides:
setStreamin classSQLChar- Parameters:
stream- the new stream
-
restoreToNull
public final void restoreToNull()
Description copied from interface:StorableRestore this object to its (SQL)null value.- Specified by:
restoreToNullin interfaceStorable- Overrides:
restoreToNullin classSQLChar- See Also:
Storable.restoreToNull()
-
setValue
public void setValue(int theValue) throws StandardExceptionDescription copied from class:DataTypeSet the value of this DataValueDescriptor to the given int value At DataType level just throws an error lower classes will override- Specified by:
setValuein interfaceDataValueDescriptor- Overrides:
setValuein classSQLChar- Parameters:
theValue- The value to set this DataValueDescriptor to- Throws:
StandardException- Thrown on error
-
setValue
public void setValue(double theValue) throws StandardExceptionDescription copied from class:DataTypeSet the value of this DataValueDescriptor to the given double value At DataType level just throws an error lower classes will override- Specified by:
setValuein interfaceDataValueDescriptor- Overrides:
setValuein classSQLChar- Parameters:
theValue- The value to set this DataValueDescriptor to- Throws:
StandardException- Thrown on error
-
setValue
public void setValue(float theValue) throws StandardExceptionDescription copied from class:DataTypeSet the value of this DataValueDescriptor to the given float value At DataType level just throws an error lower classes will override- Specified by:
setValuein interfaceDataValueDescriptor- Overrides:
setValuein classSQLChar- Parameters:
theValue- The value to set this DataValueDescriptor to- Throws:
StandardException- Thrown on error
-
setValue
public void setValue(short theValue) throws StandardExceptionDescription copied from class:DataTypeSet the value of this DataValueDescriptor to the given short value At DataType level just throws an error lower classes will override- Specified by:
setValuein interfaceDataValueDescriptor- Overrides:
setValuein classSQLChar- Parameters:
theValue- The value to set this DataValueDescriptor to- Throws:
StandardException- Thrown on error
-
setValue
public void setValue(long theValue) throws StandardExceptionDescription copied from class:DataTypeSet the value of this DataValueDescriptor to the given long value At DataType level just throws an error lower classes will override- Specified by:
setValuein interfaceDataValueDescriptor- Overrides:
setValuein classSQLChar- Parameters:
theValue- The value to set this DataValueDescriptor to- Throws:
StandardException- Thrown on error
-
setValue
public void setValue(byte theValue) throws StandardExceptionDescription copied from class:DataTypeSet the value of this DataValueDescriptor to the given byte value At DataType level just throws an error lower classes will override- Specified by:
setValuein interfaceDataValueDescriptor- Overrides:
setValuein classSQLChar- Parameters:
theValue- The value to set this DataValueDescriptor to- Throws:
StandardException- Thrown on error
-
setValue
public void setValue(boolean theValue) throws StandardExceptionDescription copied from class:DataTypeSet the value. At DataType level just throws an error lower classes will override- Specified by:
setValuein interfaceDataValueDescriptor- Overrides:
setValuein classSQLChar- Parameters:
theValue- Contains the boolean value to set this to- Throws:
StandardException
-
setValue
public void setValue(byte[] theValue) throws StandardExceptionDescription copied from class:DataTypeSet the value of this DataValueDescriptor. At DataType level just throws an error lower classes will override- Specified by:
setValuein interfaceDataValueDescriptor- Overrides:
setValuein classSQLChar- Parameters:
theValue- The byte value to set this DataValueDescriptor to- Throws:
StandardException
-
setObject
final void setObject(java.lang.Object theValue) throws StandardExceptionSet the value from an non-null Java.sql.Clob object.- Overrides:
setObjectin classDataType- Throws:
StandardException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOExceptionWrites the CLOB data value to the given destination stream using the modified UTF-8 format.- Specified by:
writeExternalin interfacejava.io.Externalizable- Overrides:
writeExternalin 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:
setStreamHeaderFormathas 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:
getStreamHeaderGeneratorin interfaceStringDataValue- Overrides:
getStreamHeaderGeneratorin 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:
setStreamHeaderFormatin interfaceStringDataValue- Overrides:
setStreamHeaderFormatin classSQLChar- Parameters:
inSoftUpgradeMode-TRUEif the database is accessed in soft upgrade mode,FALSEis not, ornullif 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.IOExceptionReads and materializes the CLOB value from the stream.- Specified by:
readExternalin interfacejava.io.Externalizable- Overrides:
readExternalin 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:
readExternalFromArrayin interfaceDataValueDescriptor- Overrides:
readExternalFromArrayin 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.IOExceptionRewinds 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
-
-