org.apache.derby.iapi.types
Class SQLClob

java.lang.Object
  extended by org.apache.derby.iapi.types.DataType
      extended by org.apache.derby.iapi.types.SQLChar
          extended by org.apache.derby.iapi.types.SQLVarchar
              extended by 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
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.
 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, getDateFormat, getDateFormat, getLocaleFinder, getNewVarchar, getObject, getStream, getString, getTime, getTimeFormat, getTimeFormat, getTimestamp, getTimestampFormat, getTimestampFormat, 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
 
Methods inherited from class org.apache.derby.iapi.types.DataType
checkHostVariable, coalesce, compare, compare, compareTo, dataTypeConversion, equals, flip, genericSetObject, getNationalString, getTypeName, in, invalidFormat, isNotNull, isNullOp, outOfRange, recycle, setInto, setToNull, 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
 

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 be 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.


inSoftUpgradeMode

private java.lang.Boolean inSoftUpgradeMode
Tells if the database is being accessed in soft upgrade mode.

Constructor Detail

SQLClob

public SQLClob()

SQLClob

public SQLClob(java.lang.String val)

SQLClob

public SQLClob(java.sql.Clob val)
Method Detail

getTypeName

public java.lang.String getTypeName()
Description copied from interface: DataValueDescriptor
Get the SQL name of the datatype

Specified by:
getTypeName in interface DataValueDescriptor
Overrides:
getTypeName in class SQLVarchar
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 interface DataValueDescriptor
Overrides:
cloneValue in class SQLVarchar
Parameters:
forceMaterialization - any streams representing the data value will be materialized if true, the data value will be kept as a stream if possible if false
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 interface DataValueDescriptor
Overrides:
getNewNull in class SQLVarchar
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 interface StringDataValue
Overrides:
getValue in class SQLVarchar
See Also:
StringDataValue.getValue(RuleBasedCollator)

getTypeFormatId

public int getTypeFormatId()
Return my format identifier.

Specified by:
getTypeFormatId in interface TypedFormat
Overrides:
getTypeFormatId in class SQLVarchar
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 interface DataValueDescriptor
Overrides:
typePrecedence in class SQLVarchar
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.

Specified by:
getBoolean in interface DataValueDescriptor
Overrides:
getBoolean in class SQLChar
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 interface DataValueDescriptor
Overrides:
getByte in class SQLChar
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 interface DataValueDescriptor
Overrides:
getShort in class SQLChar
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 interface DataValueDescriptor
Overrides:
getInt in class SQLChar
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 interface DataValueDescriptor
Overrides:
getLength in class SQLChar
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 interface DataValueDescriptor
Overrides:
getLong in class SQLChar
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 interface DataValueDescriptor
Overrides:
getFloat in class SQLChar
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 interface DataValueDescriptor
Overrides:
getDouble in class SQLChar
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 interface DataValueDescriptor
Overrides:
typeToBigDecimal in class SQLChar
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 interface DataValueDescriptor
Overrides:
getBytes in class DataType
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 interface DataValueDescriptor
Overrides:
getDate in class SQLChar
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)

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 interface StringDataValue
Overrides:
getStreamWithDescriptor in class SQLChar
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 interface DataValueDescriptor
Overrides:
hasStream in class DataType
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 interface DataValueDescriptor
Overrides:
getTime in class SQLChar
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 interface DataValueDescriptor
Overrides:
getTimestamp in class SQLChar
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 interface DataValueDescriptor
Overrides:
getTraceString in class SQLChar
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 interface DataValueDescriptor
Overrides:
normalize in class SQLVarchar
Parameters:
desiredType - The type to normalize the source column to
sourceValue - 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 interface DataValueDescriptor
Overrides:
setValue in class SQLChar
Parameters:
theValue - The Time value to set this DataValueDescriptor to
cal - 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 interface DataValueDescriptor
Overrides:
setValue in class SQLChar
Parameters:
theValue - The Timestamp value to set this DataValueDescriptor to
cal - 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 interface DataValueDescriptor
Overrides:
setValue in class SQLChar
Parameters:
theValue - The Date value to set this DataValueDescriptor to
cal - The time zone from the calendar is used to construct the database date value
Throws:
StandardException - Thrown on error

setBigDecimal

public void setBigDecimal(java.lang.Number 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 interface DataValueDescriptor
Overrides:
setBigDecimal in class SQLChar
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 interface StreamStorable
Overrides:
setStream in class SQLChar
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 interface Storable
Overrides:
restoreToNull in class SQLChar
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 interface DataValueDescriptor
Overrides:
setValue in class SQLChar
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 interface DataValueDescriptor
Overrides:
setValue in class SQLChar
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 interface DataValueDescriptor
Overrides:
setValue in class SQLChar
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 interface DataValueDescriptor
Overrides:
setValue in class SQLChar
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 interface DataValueDescriptor
Overrides:
setValue in class SQLChar
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 interface DataValueDescriptor
Overrides:
setValue in class SQLChar
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 interface DataValueDescriptor
Overrides:
setValue in class SQLChar
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 interface DataValueDescriptor
Overrides:
setValue in class SQLChar
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 class DataType
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 interface java.io.Externalizable
Overrides:
writeExternal in class SQLChar
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:

Specified by:
getStreamHeaderGenerator in interface StringDataValue
Overrides:
getStreamHeaderGenerator in class SQLChar
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 interface StringDataValue
Overrides:
setStreamHeaderFormat in class SQLChar
Parameters:
inSoftUpgradeMode - TRUE if the database is accessed in soft upgrade mode, FALSE is not, or null 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 bytes
bytesRead - 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 interface java.io.Externalizable
Overrides:
readExternal in class SQLChar
Parameters:
in - source stream
Throws:
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

readExternalFromArray

public void readExternalFromArray(ArrayInputStream in)
                           throws java.io.IOException
Reads and materializes the CLOB value from the stream.

Specified by:
readExternalFromArray in interface DataValueDescriptor
Overrides:
readExternalFromArray in class SQLChar
Parameters:
in - source stream
Throws:
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
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 rewind
offset - number of bytes to skip
Throws:
java.io.IOException - if resetting or reading from the stream fails

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.