Skip to content

Commit

Permalink
Merge pull request #160 from ramanenka/CXP-3424
Browse files Browse the repository at this point in the history
CXP-3424: Use default CDC index for SqlServer Connector
  • Loading branch information
ramanenka authored Jan 24, 2025
2 parents f823438 + 00b416a commit 2671e8b
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public class SqlServerConnection extends JdbcConnection {
+ LSN_TIMESTAMP_SELECT_STATEMENT;
private static final String GET_ALL_CHANGES_FOR_TABLE_FROM_FUNCTION = "FROM [#db].cdc.[fn_cdc_get_all_changes_#table](?, ?, N'all update old')";
private static final String GET_ALL_CHANGES_FOR_TABLE_FROM_DIRECT = "FROM [#db].cdc.[#table]";
private static final String GET_ALL_CHANGES_FOR_TABLE_ORDER_BY = "ORDER BY [__$start_lsn] ASC, [__$seqval] ASC, [__$operation] ASC";
private static final String GET_ALL_CHANGES_FOR_TABLE_FROM_FUNCTION_ORDER_BY = "ORDER BY [__$start_lsn] ASC, [__$seqval] ASC, [__$operation] ASC";
private static final String GET_ALL_CHANGES_FOR_TABLE_FROM_DIRECT_ORDER_BY = "ORDER BY [__$start_lsn] ASC, [__$command_id] ASC, [__$seqval] ASC, [__$operation] ASC";

/**
* Queries the list of captured column names and their change table identifiers in the given database.
Expand Down Expand Up @@ -212,7 +213,14 @@ private String buildGetAllChangesForTableQuery(SqlServerConnectorConfig.DataQuer
result += " WHERE " + String.join(" AND ", where) + " ";
}

result += GET_ALL_CHANGES_FOR_TABLE_ORDER_BY;
switch (dataQueryMode) {
case FUNCTION:
result += GET_ALL_CHANGES_FOR_TABLE_FROM_FUNCTION_ORDER_BY;
break;
case DIRECT:
result += GET_ALL_CHANGES_FOR_TABLE_FROM_DIRECT_ORDER_BY;
break;
}

return result;
}
Expand Down

0 comments on commit 2671e8b

Please sign in to comment.