Class SqlServerUtils
- java.lang.Object
-
- org.apache.flink.cdc.connectors.sqlserver.source.utils.SqlServerUtils
-
public class SqlServerUtils extends Object
The utils for SqlServer data source.
-
-
Constructor Summary
Constructors Constructor Description SqlServerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringbuildSplitScanQuery(io.debezium.relational.TableId tableId, org.apache.flink.table.types.logical.RowType pkRowType, boolean isFirstSplit, boolean isLastSplit)Get split scan query for the given table.static intcompare(Object obj1, Object obj2, io.debezium.relational.Column splitColumn)static io.debezium.connector.sqlserver.SqlServerDatabaseSchemacreateSqlServerDatabaseSchema(io.debezium.connector.sqlserver.SqlServerConnectorConfig connectorConfig, io.debezium.connector.sqlserver.SqlServerConnection connection)static LsnOffsetcurrentLsn(io.debezium.connector.sqlserver.SqlServerConnection connection)Fetch current largest log sequence number (LSN) of the database.static OffsetgetLsn(org.apache.kafka.connect.source.SourceRecord record)static LsnOffsetgetLsnPosition(Map<String,?> offset)static io.debezium.relational.ColumngetSplitColumn(io.debezium.relational.Table table, String chunkKeyColumn)static org.apache.flink.table.types.logical.RowTypegetSplitType(io.debezium.relational.Column splitColumn)static longqueryApproximateRowCnt(io.debezium.jdbc.JdbcConnection jdbc, io.debezium.relational.TableId tableId)static ObjectqueryNextChunkMax(io.debezium.jdbc.JdbcConnection jdbc, io.debezium.relational.TableId tableId, String splitColumnName, int chunkSize, Object includedLowerBound)Returns the next LSN to be read from the database.static Stringquote(io.debezium.relational.TableId tableId)static Stringquote(String name)static PreparedStatementreadTableSplitDataStatement(io.debezium.jdbc.JdbcConnection jdbc, String sql, boolean isFirstSplit, boolean isLastSplit, Object[] splitStart, Object[] splitEnd, int primaryKeyNum, int fetchSize)Get table split data PreparedStatement.
-
-
-
Method Detail
-
queryApproximateRowCnt
public static long queryApproximateRowCnt(io.debezium.jdbc.JdbcConnection jdbc, io.debezium.relational.TableId tableId) throws SQLException- Throws:
SQLException
-
queryNextChunkMax
public static Object queryNextChunkMax(io.debezium.jdbc.JdbcConnection jdbc, io.debezium.relational.TableId tableId, String splitColumnName, int chunkSize, Object includedLowerBound) throws SQLException
Returns the next LSN to be read from the database. This is the LSN of the last record that was read from the database.- Throws:
SQLException
-
getSplitColumn
public static io.debezium.relational.Column getSplitColumn(io.debezium.relational.Table table, @Nullable String chunkKeyColumn)
-
getSplitType
public static org.apache.flink.table.types.logical.RowType getSplitType(io.debezium.relational.Column splitColumn)
-
getLsn
public static Offset getLsn(org.apache.kafka.connect.source.SourceRecord record)
-
currentLsn
public static LsnOffset currentLsn(io.debezium.connector.sqlserver.SqlServerConnection connection)
Fetch current largest log sequence number (LSN) of the database.
-
buildSplitScanQuery
public static String buildSplitScanQuery(io.debezium.relational.TableId tableId, org.apache.flink.table.types.logical.RowType pkRowType, boolean isFirstSplit, boolean isLastSplit)
Get split scan query for the given table.
-
readTableSplitDataStatement
public static PreparedStatement readTableSplitDataStatement(io.debezium.jdbc.JdbcConnection jdbc, String sql, boolean isFirstSplit, boolean isLastSplit, Object[] splitStart, Object[] splitEnd, int primaryKeyNum, int fetchSize)
Get table split data PreparedStatement.
-
createSqlServerDatabaseSchema
public static io.debezium.connector.sqlserver.SqlServerDatabaseSchema createSqlServerDatabaseSchema(io.debezium.connector.sqlserver.SqlServerConnectorConfig connectorConfig, io.debezium.connector.sqlserver.SqlServerConnection connection)
-
quote
public static String quote(io.debezium.relational.TableId tableId)
-
-