Package oracle.streams
Class DefaultRowLCR
- java.lang.Object
-
- oracle.streams.AbstractLCR
-
- oracle.streams.DefaultRowLCR
-
public class DefaultRowLCR extends AbstractLCR implements RowLCR
The DefaultRowLCR class provides an Oracle default implementation of the RowLCR interface.
-
-
Field Summary
-
Fields inherited from interface oracle.streams.LCR
ATTRIBUTE_ROOT_NAME, ATTRIBUTE_ROW_ID, ATTRIBUTE_SERIAL_NUM, ATTRIBUTE_SESSION_NUM, ATTRIBUTE_THREAD_NUM, ATTRIBUTE_TX_NAME, ATTRIBUTE_USERNAME
-
-
Constructor Summary
Constructors Constructor Description DefaultRowLCR()
Constructs a RowLCR object with NULL values.DefaultRowLCR(java.lang.String sourceDatabaseName, java.lang.String commandType, java.lang.String objectOwner, java.lang.String objectName, java.lang.String transactionId, byte[] tag, byte[] position, oracle.sql.DATE sourceTime)
Constructs a RowLCR object with given LCR parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnValue[]
getBinds()
Gets the bind values that bind the SQL statement generated using getStatement().java.lang.String
getDateFormat()
Gets the date format of a row LCR.ColumnValue[]
getNewValues()
Gets the list of new column values in a row LCR.ColumnValue[]
getOldValues()
Gets the list of old column values in a row LCR.java.lang.String
getStatement(boolean bind)
Generates a SQL statement from the row LCR.java.lang.String
getTimeStampFormat()
Gets the timestamp format.java.lang.String
getWhereClause(boolean bind)
Gets a WHERE clause for the change that is encapsulated in the row LCR.ColumnValue[]
getWhereClauseBinds()
Gets the bind array to be used with the WHERE clause generated by getWhereClause().boolean
hasChunkData()
Indicates whether this LCR contains chunk data for LOB, LONG, or XMLTYPE columns.boolean
hasIDKeyColumnsOnly()
Indicates whether the LCR only has identification key columns.boolean
isSequenceLCR()
Indicates whether the LCR is a sequence LCR, which is generated by accessing NEXTVAL of an Oracle sequence.void
setChunkDataFlag(boolean chunkDataFlag)
Sets the chunkDataFlag.void
setDateFormat(java.lang.String dateFormat)
Sets the date format that is used to convert a DATE value to a String value.void
setIDKeyColumnsOnly(boolean IDKeyColumnsOnly)
Sets whether or not this LCR only has identification key columns.void
setNewValues(ColumnValue[] newValues)
Sets the new column values list for a RowLCR.void
setOldValues(ColumnValue[] oldValues)
Sets the old column values list for a row LCR.void
setSequenceLCRFlag(boolean sequenceLCRFlag)
Sets the sequence LCR flag.void
setTimeStampFormat(java.lang.String timeStampFormat)
Sets the timestamp format that is used to convert a TIMESTAMP value to a String valuejava.lang.String
toString()
-
Methods inherited from class oracle.streams.AbstractLCR
getAttribute, getAttributeName, getAttributesList, getAttributeValue, getCommandType, getCommitSCN, getMessageTrackingLabel, getNumAttributes, getObjectName, getObjectOwner, getPosition, getRootName, getSCN, getSourceDatabaseName, getSourceTime, getTag, getTransactionId, setAttribute, setCommandType, setMessageTrackingLabel, setObjectName, setObjectOwner, setPosition, setRootName, setSourceDatabaseName, setSourceTime, setTag, setTransactionId
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface oracle.streams.LCR
getAttribute, getCommandType, getObjectName, getObjectOwner, getPosition, getSourceDatabaseName, getSourceTime, getTag, getTransactionId, setAttribute, setCommandType, setObjectName, setObjectOwner, setPosition, setSourceDatabaseName, setSourceTime, setTag, setTransactionId
-
-
-
-
Constructor Detail
-
DefaultRowLCR
public DefaultRowLCR(java.lang.String sourceDatabaseName, java.lang.String commandType, java.lang.String objectOwner, java.lang.String objectName, java.lang.String transactionId, byte[] tag, byte[] position, oracle.sql.DATE sourceTime)
Constructs a RowLCR object with given LCR parameters.- Parameters:
sourceDatabaseName
- source database name.commandType
- RowLCR command type.objectOwner
- object owner.objectName
- object name.transactionId
- transaction ID.tag
- LCR tag.position
- LCR position.sourceTime
- source timestamp.
-
DefaultRowLCR
public DefaultRowLCR()
Constructs a RowLCR object with NULL values.
-
-
Method Detail
-
getOldValues
public ColumnValue[] getOldValues()
Gets the list of old column values in a row LCR.
These are the column values for the row before the DML change. Note that the returned ColumnValue[] is mutable.
If the DML statement is an UPDATE or a DELETE statement, then this parameter contains the values of columns in the row before the DML statement.
If the DML statement is an INSERT statement, then there are no old values and NULL is returned. Note that the returned ColumnValue[] is mutable- Specified by:
getOldValues
in interfaceRowLCR
- Returns:
- A ColumnValue array contains the old column value
-
getNewValues
public ColumnValue[] getNewValues()
Gets the list of new column values in a row LCR.
These are the column values for the row after the DML change. Note that the returned ColumnValue[] is mutable.
If the DML statement is an UPDATE or an INSERT statement, then this parameter contains the values of columns in the row after the DML statement.
If the DML statement is a DELETE statement, then there are no new values and NULL is returned.
Note that the returned ColumnValue[] is mutable- Specified by:
getNewValues
in interfaceRowLCR
- Returns:
- A ColumnValue array contains the new column value
-
setOldValues
public void setOldValues(ColumnValue[] oldValues)
Sets the old column values list for a row LCR.
If the DML statement is an UPDATE or a DELETE statement, then set this parameter to a non-NULL value.
If the DML statement is an INSERT statement, then set this parameter to a NULL value.- Specified by:
setOldValues
in interfaceRowLCR
- Parameters:
oldValues
- The old column value array
-
setNewValues
public void setNewValues(ColumnValue[] newValues)
Sets the new column values list for a RowLCR.
If the DML statement is an UPDATE or an INSERT statement, then set this parameter to a non-NULL value.
If the DML statement is a DELETE statement, then set this parameter to a NULL value.- Specified by:
setNewValues
in interfaceRowLCR
- Parameters:
newValues
- The new column value array
-
hasChunkData
public boolean hasChunkData()
Indicates whether this LCR contains chunk data for LOB, LONG, or XMLTYPE columns.
If an LCR contains chunk data for LOB, LONG, or XMLTYPE columns and must use the XStreamOUT APIs for chunking, then call this method to check whether the LCR contains chunk data and invoke the XStreamOut APIs for chunking accordingly.- Specified by:
hasChunkData
in interfaceRowLCR
- Returns:
- A boolean flag indicates if this LCR contains chunk data.
-
setChunkDataFlag
public void setChunkDataFlag(boolean chunkDataFlag)
Sets the chunkDataFlag.
If an LCR contains chunk data for LOB, LONG, or XMLTYPE columns and must use the XStreamOUT APIs for chunking, then call this method to set the chunkDataFLag to true and invoke the XStreamOut APIs for chunking accordingly.- Specified by:
setChunkDataFlag
in interfaceRowLCR
- Parameters:
chunkDataFlag
- indicates whether this LCR contains chunk data.
-
getDateFormat
public java.lang.String getDateFormat()
Gets the date format of a row LCR.- Returns:
- returns the date format set by the user.
returns null if nothing was set.
-
getTimeStampFormat
public java.lang.String getTimeStampFormat()
Gets the timestamp format.- Returns:
- returns the timestamp format set by the user.
returns null if nothing was set.
-
setDateFormat
public void setDateFormat(java.lang.String dateFormat)
Sets the date format that is used to convert a DATE value to a String value.- Parameters:
dateFormat
- The date format to be used to convert the date to
string. null value passed will use the default date format. The symbols used in the format string should conform to JDBC format specification. The default format is 'yyyy-MM-dd'
-
setTimeStampFormat
public void setTimeStampFormat(java.lang.String timeStampFormat)
Sets the timestamp format that is used to convert a TIMESTAMP value to a String value- Parameters:
timeStampFormat
- The timestamp format to be used to convert the
timestamp to string. null value passed will use the default
timestamp format The symbols used in the format string should conform to JDBC format specification. The default format is 'yyyy-MM-dd HH:mm:ss.SSS'
-
getStatement
public java.lang.String getStatement(boolean bind) throws StreamsException
Generates a SQL statement from the row LCR.- Parameters:
bind
- When true, generates SQL with bind variables. When false, generates SQL with inline values. LOB values cannot be inlined. A StreamsException is thrown when set to false and the row LCR contains LOB values. This value is only used for non-statement LCRs- Returns:
- The generated SQL string.
- Throws:
StreamsException
- Thrown if any of the datatypes cannot be unparsed to a string or if any datatype of the columns in the table does not have JDBC equivalent.
-
getBinds
public ColumnValue[] getBinds()
Gets the bind values that bind the SQL statement generated using getStatement().- Returns:
- Array of binds to be bound to the sql generated by getStatement()
The array index of the element determines the position of bind.
This method can be used after generating SQL with inlined values, but the returned bind array might be difficult to use.
-
getWhereClause
public java.lang.String getWhereClause(boolean bind) throws StreamsException
Gets a WHERE clause for the change that is encapsulated in the row LCR. The WHERE clause generated identifes the row that this lcr is operating on. Use this method when an LCR contains a LOB column and multiple SQL statements must be generated for piecewise LOB operaions.- Parameters:
bind
- When true, generates SQL with bind variables. When false, generates SQL with inline values. LOB values cannot be inlined. A StreamsException is thrown when set to false and the row LCR contains LOB values.- Returns:
- returns generated where clause, which includes the 'WHERE' keyword
- Throws:
StreamsException
- Thrown if any of the datatypes cannot be unparsed to a string or if any datatype of the columns in the table does not have JDBC equivalent.
-
getWhereClauseBinds
public ColumnValue[] getWhereClauseBinds()
Gets the bind array to be used with the WHERE clause generated by getWhereClause().- Returns:
- Array of ColumnValue containing the bind columns in the bind order
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
setSequenceLCRFlag
public void setSequenceLCRFlag(boolean sequenceLCRFlag)
Sets the sequence LCR flag.- Parameters:
sequenceLCRFlag
- indicates whether this LCR is a sequence LCR, which is generated by accessing NEXTVAL of an Oracle sequence.
-
isSequenceLCR
public boolean isSequenceLCR()
Indicates whether the LCR is a sequence LCR, which is generated by accessing NEXTVAL of an Oracle sequence.- Returns:
- true if this LCR is a sequence LCR.
-
hasIDKeyColumnsOnly
public boolean hasIDKeyColumnsOnly()
Indicates whether the LCR only has identification key columns. Note that this LCR is incomplete, it is expected that the client will use the identification colums and rowid to query the source database for the full set of columns.- Returns:
- true if this LCR only has identification key columns.
-
setIDKeyColumnsOnly
public void setIDKeyColumnsOnly(boolean IDKeyColumnsOnly)
Sets whether or not this LCR only has identification key columns.- Parameters:
IDKeyColumnsOnly
- indicates whether this LCR only has identification columns. Note this is not typically expected to be true.
-
-