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.- Author:
- Jiri Pechanec
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classSqlServerChangeTablePointer.IndicesMapping
-
Field Summary
Fields Modifier and Type Field Description private static intCOL_COMMIT_LSNprivate static intCOL_DATAprivate static intCOL_OPERATIONprivate static intCOL_ROW_LSNprivate intcolumnDataOffsetprivate static intINVALID_COLUMN_INDEXprivate static org.slf4j.LoggerLOGGERprivate ResultSetresultSetprivate JdbcConnection.ResultSetMapper<Object[]>resultSetMapperprivate SourceTimestampModesourceTimestampMode
-
Constructor Summary
Constructors Constructor Description SqlServerChangeTablePointer(SqlServerChangeTable changeTable, ResultSet resultSet, SourceTimestampMode sourceTimestampMode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private 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 ObjectgetColumnData(ResultSet resultSet, int columnIndex)Object[]getData()protected TxLogPositiongetNextChangePosition(ResultSet resultSet)protected intgetOperation(ResultSet resultSet)protected ResultSetgetResultSet()protected booleanisNewTransaction()Check whether TX in currentChangePosition is newer (higher) than TX in previousChangePosition-
Methods inherited from class io.debezium.pipeline.source.spi.ChangeTableResultSet
compareTo, getChangePosition, getChangeTable, getOperation, getPreviousChangePosition, isCompleted, isCurrentPositionSmallerThanPreviousPosition, next, toString
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
INVALID_COLUMN_INDEX
private static final int INVALID_COLUMN_INDEX
- See Also:
- Constant Field Values
-
COL_COMMIT_LSN
private static final int COL_COMMIT_LSN
- See Also:
- Constant Field Values
-
COL_ROW_LSN
private static final int COL_ROW_LSN
- See Also:
- Constant Field Values
-
COL_OPERATION
private static final int COL_OPERATION
- See Also:
- Constant Field Values
-
COL_DATA
private static final int COL_DATA
- See Also:
- Constant Field Values
-
resultSetMapper
private JdbcConnection.ResultSetMapper<Object[]> resultSetMapper
-
resultSet
private final ResultSet resultSet
-
sourceTimestampMode
private final SourceTimestampMode sourceTimestampMode
-
columnDataOffset
private final int columnDataOffset
-
-
Constructor Detail
-
SqlServerChangeTablePointer
public SqlServerChangeTablePointer(SqlServerChangeTable changeTable, ResultSet resultSet, SourceTimestampMode sourceTimestampMode)
-
-
Method Detail
-
getResultSet
protected ResultSet getResultSet()
-
getOperation
protected int getOperation(ResultSet resultSet) throws SQLException
- Specified by:
getOperationin classChangeTableResultSet<SqlServerChangeTable,TxLogPosition>- Throws:
SQLException
-
getColumnData
protected Object getColumnData(ResultSet resultSet, int columnIndex) throws SQLException
- Overrides:
getColumnDatain classChangeTableResultSet<SqlServerChangeTable,TxLogPosition>- Throws:
SQLException
-
getNextChangePosition
protected TxLogPosition getNextChangePosition(ResultSet resultSet) throws SQLException
- Specified by:
getNextChangePositionin classChangeTableResultSet<SqlServerChangeTable,TxLogPosition>- Throws:
SQLException
-
isNewTransaction
protected boolean isNewTransaction() throws SQLExceptionCheck whether TX in currentChangePosition is newer (higher) than TX in previousChangePosition- Returns:
- true <=> TX in currentChangePosition > TX in previousChangePosition
- Throws:
SQLException
-
getData
public Object[] getData() throws SQLException
- Overrides:
getDatain 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
-
-