// never should get this far
if (SanityManager.DEBUG)
SanityManager.ASSERT(!dvd.isNull(),
"clob is created on top of a null column");
CharacterStreamDescriptor csd = dvd.getStreamWithDescriptor();
// See if a String or a stream will be the source of the Clob.
if (csd == null) {
try {
clob = new TemporaryClob(dvd.getString(),
this);
}
catch (SQLException sqle) {
throw StandardException.newException (sqle.getSQLState(), sqle);
}
catch (IOException e) {
throw StandardException.newException (
SQLState.SET_STREAM_FAILURE, e);
}
} else {
/*
We are expecting this stream to be a FormatIdInputStream with an
OverflowInputStream inside. FormatIdInputStream implements
Resetable, as does OverflowInputStream. This should be the case
when retrieving data from a long column. However, SQLChar, which is
the class implementing the getStream() method for dvd.getStream(),
does not guarantee this for us. In particular, the logging system
(see StoredPage.logColumn) calls setStream with an argument that
is sometimes a RememberBytesInputStream on a SQLChar object
(e.g. see test repStreaming.sql). However, such a SQLChar
object is going to the log buffer, NOT back to the user, so it
should not break the ASSERT below.
*/
if (SanityManager.DEBUG)
SanityManager.ASSERT(csd.getStream() instanceof Resetable);
try {
this.clob = new StoreStreamClob(csd, this);
} catch (StandardException se) {
if (se.getMessageId().equals(SQLState.DATA_CONTAINER_CLOSED)) {