Package io.debezium.connector.sqlserver
Class SqlServerChangeTablePointer
java.lang.Object
io.debezium.pipeline.source.spi.ChangeTableResultSet<SqlServerChangeTable,TxLogPosition>
io.debezium.connector.sqlserver.SqlServerChangeTablePointer
public class SqlServerChangeTablePointer
extends ChangeTableResultSet<SqlServerChangeTable,TxLogPosition>
The logical representation of a position for the change in the transaction log.
During each sourcing cycle it is necessary to query all change tables and then
make a total order of changes across all tables.
This class represents an open database cursor over the change table that is able to move the cursor forward and report the LSN for the change to which the cursor now points.
This class represents an open database cursor over the change table that is able to move the cursor forward and report the LSN for the change to which the cursor now points.
- Author:
- Jiri Pechanec
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private static final int
private static final int
private final int
private static final int
private static final org.slf4j.Logger
private final ResultSet
private JdbcConnection.ResultSetMapper<Object[]>
-
Constructor Summary
ConstructorsConstructorDescriptionSqlServerChangeTablePointer
(SqlServerChangeTable changeTable, ResultSet resultSet) -
Method Summary
Modifier and TypeMethodDescriptionprivate JdbcConnection.ResultSetMapper<Object[]>
createResultSetMapper
(Table table) Internally each row is represented as an array of objects, where the order of values corresponds to the order of columns (fields) in the table schema.protected Object
getColumnData
(ResultSet resultSet, int columnIndex) Object[]
getData()
protected TxLogPosition
getNextChangePosition
(ResultSet resultSet) protected int
getOperation
(ResultSet resultSet) protected ResultSet
protected boolean
Check whether TX in currentChangePosition is newer (higher) than TX in previousChangePositionMethods inherited from class io.debezium.pipeline.source.spi.ChangeTableResultSet
compareTo, getChangePosition, getChangeTable, getOperation, getPreviousChangePosition, isCompleted, isCurrentPositionSmallerThanPreviousPosition, next, toString
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
INVALID_COLUMN_INDEX
private static final int INVALID_COLUMN_INDEX- See Also:
-
COL_COMMIT_LSN
private static final int COL_COMMIT_LSN- See Also:
-
COL_ROW_LSN
private static final int COL_ROW_LSN- See Also:
-
COL_OPERATION
private static final int COL_OPERATION- See Also:
-
COL_DATA
private static final int COL_DATA- See Also:
-
resultSetMapper
-
resultSet
-
columnDataOffset
private final int columnDataOffset
-
-
Constructor Details
-
SqlServerChangeTablePointer
-
-
Method Details
-
getResultSet
-
getOperation
- Specified by:
getOperation
in classChangeTableResultSet<SqlServerChangeTable,
TxLogPosition> - Throws:
SQLException
-
getColumnData
- Overrides:
getColumnData
in classChangeTableResultSet<SqlServerChangeTable,
TxLogPosition> - Throws:
SQLException
-
getNextChangePosition
- Specified by:
getNextChangePosition
in classChangeTableResultSet<SqlServerChangeTable,
TxLogPosition> - Throws:
SQLException
-
isNewTransaction
Check whether TX in currentChangePosition is newer (higher) than TX in previousChangePosition- Returns:
- true <=> TX in currentChangePosition > TX in previousChangePosition
- Throws:
SQLException
-
getData
- Overrides:
getData
in classChangeTableResultSet<SqlServerChangeTable,
TxLogPosition> - Throws:
SQLException
-
createResultSetMapper
private JdbcConnection.ResultSetMapper<Object[]> createResultSetMapper(Table table) throws SQLException Internally each row is represented as an array of objects, where the order of values corresponds to the order of columns (fields) in the table schema. However, when capture instance contains only a subset of original's table column, in order to preserve the aforementioned order of values in array, raw database results have to be adjusted accordingly.- Parameters:
table
- original table- Returns:
- a mapper which adjusts order of values in case the capture instance contains only a subset of columns
- Throws:
SQLException
-