Top Description Fields Constructors Methods
org.apache.derby.impl.store.raw.data

public final Class UpdateOperation

extends PhysicalPageOperation
Class Inheritance
Imports
org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.io.StoredFormatIds, .FormatableBitSet, .CompressedNumber, .DynamicByteArrayOutputStream, .LimitObjectInput, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.raw.ContainerHandle, .LockingPolicy, .Page, .RecordHandle, .Transaction, org.apache.derby.iapi.store.raw.log.LogInstant, org.apache.derby.iapi.store.raw.xact.RawTransaction, org.apache.derby.iapi.util.ByteArray, java.io.ObjectOutput, .ObjectInput, .IOException

Represents the update of a particular row on a page.

Field Summary

Modifier and TypeField and Description
protected int
protected transient int
protected transient ByteArray
protected int

Constructor Summary

AccessConstructor and Description
pack-priv
UpdateOperation(RawTransaction t, BasePage page, int slot, int recordId, Object[] row, FormatableBitSet validColumns, int realStartColumn, DynamicByteArrayOutputStream logBuffer, int realSpaceOnPage, RecordHandle headRowHandle)

public

Method Summary

Modifier and TypeMethod and Description
public void
doMe(Transaction
the Transaction
xact
,
LogInstant
the log instant of this operation
instant
,
LimitObjectInput
optional data
in
)

Implements org.apache.derby.iapi.store.raw.Loggable.doMe.

Store the new record directly over the old record, the implementation of storeRecord is responsible for removing any old data.

public int
getNextStartColumn()

Return the last column of the row this operation logged

public ByteArray
getPreparedLog()

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.getPreparedLog.

Implements org.apache.derby.iapi.store.raw.Loggable.getPreparedLog.

The log operations are responsible to create the ByteArray, and the log operations should write out any optional data for the change to the ByteArray.

private RecordHandle
getRecordHandle()

return RecordHandle of the update row.

public int
public void
readExternal(ObjectInput
the stream to read data from in order to restore the object
in
)

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.readExternal.

Implements java.io.Externalizable.readExternal.

Read this in

public void
reclaimPrepareLocks(Transaction t, LockingPolicy
The locking policy to use to claim the locks.
locking_policy
)

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.reclaimPrepareLocks.

Implements org.apache.derby.iapi.store.raw.RePreparable.reclaimPrepareLocks.

reclaim locks associated with the changes in this log record.

public void
restoreMe(Transaction
the Transaction doing the rollback
xact
,
BasePage
the page to rollback changes on
undoPage
,
LogInstant
the log instant of this (PageUndo) operation
CLRInstant
,
LimitObjectInput
optional data for the rollback operation
in
)

Implements abstract org.apache.derby.impl.store.raw.data.PageBasicOperation.restoreMe.

restore the before image of the page

public String
toString()

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.toString.

Returns a string representation of the object.

public void
undoMe(Transaction
the Transaction doing the rollback
xact
,
BasePage
the page to rollback changes on
undoPage
,
LogInstant
the log instant of this (PageUndo) operation
CLRInstant
,
LimitObjectInput
optional data for the rollback operation
in
)

Implements abstract org.apache.derby.impl.store.raw.data.PhysicalPageOperation.undoMe.

Store the old record directly over the new record, the implementation of storeRecord is responsible for removing any new data.

public void
writeExternal(ObjectOutput
the stream to write the object to
out
)

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.writeExternal.

Implements java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

private void
writeOptionalDataToBuffer(RawTransaction t, DynamicByteArrayOutputStream logBuffer, Object[] row, FormatableBitSet validColumns, int realStartColumn, int realSpaceOnPage, RecordHandle headRowHandle)

Write out the changed colums of new record (from the row) followed by changed columns of the old record (from the page).

Inherited from org.apache.derby.impl.store.raw.data.PhysicalPageOperation:
generateUndo

Field Detail

doMeSlotback to summary
protected int doMeSlot
nextColumnback to summary
protected transient int nextColumn
preparedLogback to summary
protected transient ByteArray preparedLog
recordIdback to summary
protected int recordId

Constructor Detail

UpdateOperationback to summary
pack-priv UpdateOperation(RawTransaction t, BasePage page, int slot, int recordId, Object[] row, FormatableBitSet validColumns, int realStartColumn, DynamicByteArrayOutputStream logBuffer, int realSpaceOnPage, RecordHandle headRowHandle) throws StandardException
UpdateOperationback to summary
public UpdateOperation()

Method Detail

doMeback to summary
public void doMe(Transaction xact, LogInstant instant, LimitObjectInput in) throws StandardException, IOException

Implements org.apache.derby.iapi.store.raw.Loggable.doMe.

Store the new record directly over the old record, the implementation of storeRecord is responsible for removing any old data.

Parameters
xact:Transaction

Doc from org.apache.derby.iapi.store.raw.Loggable.doMe.

the Transaction

instant:LogInstant

Doc from org.apache.derby.iapi.store.raw.Loggable.doMe.

the log instant of this operation

in:LimitObjectInput

Doc from org.apache.derby.iapi.store.raw.Loggable.doMe.

optional data

Exceptions
StandardException:
Thrown by methods I call
IOException:
Thrown by methods I call
See Also
BasePage#storeRecord, org.apache.derby.iapi.store.raw.Loggable#doMe
getNextStartColumnback to summary
public int getNextStartColumn()

Return the last column of the row this operation logged

getPreparedLogback to summary
public ByteArray getPreparedLog()

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.getPreparedLog.

Implements org.apache.derby.iapi.store.raw.Loggable.getPreparedLog.

Doc from org.apache.derby.iapi.store.raw.Loggable.getPreparedLog.

The log operations are responsible to create the ByteArray, and the log operations should write out any optional data for the change to the ByteArray. The ByteArray can be prepared when the log operation is constructed, or it can be prepared when getPreparedLog() is called. Called by the log manager to allow the log operation to pass the buffer which contains optional data that will be available in to doMe() methods.

getRecordHandleback to summary
private RecordHandle getRecordHandle()

return RecordHandle of the update row.

Return the RecordHandle that should be locked when updating the row in this UpdateOperation.

getTypeFormatIdback to summary
public int getTypeFormatId()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Return my format identifier.

Returns:int

Doc from org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

The identifier. (A UUID stuffed in an array of 16 bytes).

readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.readExternal.

Implements java.io.Externalizable.readExternal.

Read this in

Parameters
in:ObjectInput

Doc from java.io.Externalizable.readExternal.

the stream to read data from in order to restore the object

Exceptions
IOException:
error reading from log stream
ClassNotFoundException:
log stream corrupted
reclaimPrepareLocksback to summary
public void reclaimPrepareLocks(Transaction t, LockingPolicy locking_policy) throws StandardException

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.reclaimPrepareLocks.

Implements org.apache.derby.iapi.store.raw.RePreparable.reclaimPrepareLocks.

reclaim locks associated with the changes in this log record.

Parameters
locking_policy:LockingPolicy

The locking policy to use to claim the locks.

Exceptions
StandardException:
Standard exception policy.
restoreMeback to summary
public void restoreMe(Transaction xact, BasePage undoPage, LogInstant CLRInstant, LimitObjectInput in) throws StandardException, IOException

Implements abstract org.apache.derby.impl.store.raw.data.PageBasicOperation.restoreMe.

restore the before image of the page

Parameters
xact:Transaction

Doc from org.apache.derby.impl.store.raw.data.PageBasicOperation.restoreMe.

the Transaction doing the rollback

undoPage:BasePage

Doc from org.apache.derby.impl.store.raw.data.PageBasicOperation.restoreMe.

the page to rollback changes on

CLRInstant:LogInstant

Doc from org.apache.derby.impl.store.raw.data.PageBasicOperation.restoreMe.

the log instant of this (PageUndo) operation

in:LimitObjectInput

Doc from org.apache.derby.impl.store.raw.data.PageBasicOperation.restoreMe.

optional data for the rollback operation

Exceptions
StandardException:
Standard Derby Error Policy
IOException:
problem reading the complete log record from the input stream
toStringback to summary
public String toString()

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

undoMeback to summary
public void undoMe(Transaction xact, BasePage undoPage, LogInstant CLRInstant, LimitObjectInput in) throws StandardException, IOException

Implements abstract org.apache.derby.impl.store.raw.data.PhysicalPageOperation.undoMe.

Store the old record directly over the new record, the implementation of storeRecord is responsible for removing any new data.

Parameters
xact:Transaction

Doc from org.apache.derby.impl.store.raw.data.PhysicalPageOperation.undoMe.

the Transaction doing the rollback

undoPage:BasePage

Doc from org.apache.derby.impl.store.raw.data.PhysicalPageOperation.undoMe.

the page to rollback changes on

CLRInstant:LogInstant

Doc from org.apache.derby.impl.store.raw.data.PhysicalPageOperation.undoMe.

the log instant of this (PageUndo) operation

in:LimitObjectInput

Doc from org.apache.derby.impl.store.raw.data.PhysicalPageOperation.undoMe.

optional data for the rollback operation

Exceptions
StandardException:
Thrown by methods I call
IOException:
Thrown by methods I call
See Also
BasePage#storeRecord, PhysicalPageOperation#undoMe
writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Overrides org.apache.derby.impl.store.raw.data.PageBasicOperation.writeExternal.

Implements java.io.Externalizable.writeExternal.

Doc from java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Parameters
out:ObjectOutput

the stream to write the object to

Exceptions
IOException:
Includes any I/O exceptions that may occur
writeOptionalDataToBufferback to summary
private void writeOptionalDataToBuffer(RawTransaction t, DynamicByteArrayOutputStream logBuffer, Object[] row, FormatableBitSet validColumns, int realStartColumn, int realSpaceOnPage, RecordHandle headRowHandle) throws StandardException, IOException

Write out the changed colums of new record (from the row) followed by changed columns of the old record (from the page).

Exceptions
StandardException:
Thrown by methods I call
IOException:
Thrown by methods I call