(int) b.length(),
b.getBinaryStream(),
writeNullByte,
index + 1);
} catch (java.sql.SQLException e) {
throw new SqlException(netAgent_.logWriter_,
new ClientMessageId(SQLState.NET_ERROR_GETTING_BLOB_LENGTH),
e);
}
} else if (((Blob) b).isBinaryStream()) {
writeScalarStream(chainFlag,
chainedWithSameCorrelator,
CodePoint.EXTDTA,
(int) ((Blob) b).length(),
((Blob) b).getBinaryStream(),
writeNullByte,
index + 1);
} else { // must be a binary string
// note: a possible optimization is to use writeScalarLobBytes
// when the input is small
// use this: if (b.length () < DssConstants.MAX_DSS_LEN - 6 - 4)
// writeScalarLobBytes (...)
// Yes, this would avoid having to new up a java.io.ByteArrayInputStream
writeScalarStream(chainFlag,
chainedWithSameCorrelator,
CodePoint.EXTDTA,
(int) ((Blob) b).length(),
((Blob) b).getBinaryStream(),
writeNullByte,
index + 1);
}
}
// the follow types are possible due to promotion to CLOB
else if (
parameterType == Types.CLOB
|| parameterType == Types.CHAR
|| parameterType == Types.VARCHAR
|| parameterType == Types.LONGVARCHAR) {
Clob o = (Clob) retrievePromotedParameterIfExists(index);
java.sql.Clob c = (o == null) ? (java.sql.Clob) inputRow[index] : o;
boolean isExternalClob = !(c instanceof org.apache.derby.client.am.Clob);
if (isExternalClob) {
try {
writeScalarStream(chainFlag,
chainedWithSameCorrelator,
CodePoint.EXTDTA,
(int) c.length(),
c.getCharacterStream(),
writeNullByte,
index + 1);
} catch (java.sql.SQLException e) {
throw new SqlException(netAgent_.logWriter_,
new ClientMessageId(SQLState.NET_ERROR_GETTING_BLOB_LENGTH),
e);
}
} else if (((Clob) c).isCharacterStream()) {
writeScalarStream(chainFlag,
chainedWithSameCorrelator,
CodePoint.EXTDTA,
(int) ((Clob) c).length(),
((Clob) c).getCharacterStream(),
writeNullByte,
index + 1);
} else if (((Clob) c).isAsciiStream()) {
writeScalarStream(chainFlag,
chainedWithSameCorrelator,
CodePoint.EXTDTA,
(int) ((Clob) c).length(),
((Clob) c).getAsciiStream(),
writeNullByte,
index + 1);
} else if (((Clob) c).isUnicodeStream()) {
writeScalarStream(chainFlag,
chainedWithSameCorrelator,
CodePoint.EXTDTA,
(int) ((Clob) c).length(),
((Clob) c).getUnicodeStream(),
writeNullByte,
index + 1);
} else { // must be a String
// note: a possible optimization is to use writeScalarLobBytes
// when the input is small.
// use this: if (c.length () < DssConstants.MAX_DSS_LEN - 6 - 4)
// writeScalarLobBytes (...)
writeScalarStream(chainFlag,
chainedWithSameCorrelator,
CodePoint.EXTDTA,
(int) ((Clob) c).getUTF8Length(),
new java.io.ByteArrayInputStream(((Clob) c).getUtf8String()),
writeNullByte,
index + 1);
}
}
}
}
}
catch ( java.sql.SQLException se )
{
throw new SqlException(se);
}
}