use of org.apache.derby.iapi.util.ByteArray in project derby by apache.
the class InsertOperation method writeOptionalDataToBuffer.
/**
* Writes out the row that is to be inserted as the optional data.
*
* @exception IOException Can be thrown by any of the methods of ObjectOutput
* @exception StandardException Standard Derby policy.
*/
private void writeOptionalDataToBuffer(RawTransaction t, DynamicByteArrayOutputStream logBuffer, Object[] row, FormatableBitSet validColumns, boolean isLongColumn, int realStartColumn, int realSpaceOnPage, int overflowThreshold) throws StandardException, IOException {
if (SanityManager.DEBUG) {
SanityManager.ASSERT(this.page != null);
}
DynamicByteArrayOutputStream localLogBuffer = null;
if (logBuffer != null) {
localLogBuffer = (DynamicByteArrayOutputStream) logBuffer;
} else {
realStartColumn = -1;
realSpaceOnPage = -1;
localLogBuffer = t.getLogBuffer();
}
if (isLongColumn) {
this.startColumn = this.page.logLongColumn(doMeSlot, recordId, row[0], localLogBuffer);
} else {
this.startColumn = this.page.logRow(doMeSlot, true, recordId, row, validColumns, localLogBuffer, this.startColumn, insertFlag, realStartColumn, realSpaceOnPage, overflowThreshold);
}
int optionalDataStart = localLogBuffer.getBeginPosition();
int optionalDataLength = localLogBuffer.getPosition() - optionalDataStart;
this.preparedLog = new ByteArray(localLogBuffer.getByteArray(), optionalDataStart, optionalDataLength);
}
use of org.apache.derby.iapi.util.ByteArray in project derby by apache.
the class ClassLoadingTest method test_01_6654.
/**
* Test that you can't use Derby's custom class loader to load arbitrary
* class files. See DERBY-6654.
*/
public void test_01_6654() throws Exception {
ByteArray classBytes = new ByteArray(new byte[] { (byte) 1 });
Connection conn = getConnection();
LanguageConnectionContext lcc = ConstraintCharacteristicsTest.getLCC(conn);
ClassFactory classFactory = lcc.getLanguageConnectionFactory().getClassFactory();
String className1 = "BadClassName";
String className2 = "bad.class.Name";
vet6654(classFactory, className1, classBytes);
vet6654(classFactory, className2, classBytes);
}
use of org.apache.derby.iapi.util.ByteArray in project derby by apache.
the class GenericStorablePreparedStatement method readExternal.
/**
* @see java.io.Externalizable#readExternal
*
* @exception IOException on error
* @exception ClassNotFoundException on error
*/
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
setCursorInfo((CursorInfo) in.readObject());
setNeedsSavepoint(in.readBoolean());
isAtomic = (in.readBoolean());
executionConstants = (ConstantAction) in.readObject();
resultDesc = (ResultDescription) in.readObject();
if (in.readBoolean()) {
savedObjects = new Object[ArrayUtil.readArrayLength(in)];
ArrayUtil.readArrayItems(in, savedObjects);
}
className = (String) in.readObject();
if (in.readBoolean()) {
byteCode = new ByteArray();
byteCode.readExternal(in);
} else
byteCode = null;
}
Aggregations