|
@@ -32,17 +32,17 @@ public class SqlServerExtractor extends AbstractDatabaseExtractor {
|
|
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
private static final String STATEMENTS_PLACEHOLDER = "#";
|
|
|
- private static final String GET_DATABASE_NAME = "SELECT db_name()";
|
|
|
- private static final String GET_TABLE_LIST = "SELECT NAME FROM SYS.TABLES WHERE SCHEMA_ID = SCHEMA_ID('#') AND IS_MS_SHIPPED = 0";
|
|
|
- private static final String IS_DB_CDC_ENABLED = "SELECT is_cdc_enabled FROM sys.databases WHERE name = '#'";
|
|
|
- private static final String IS_TABLE_CDC_ENABLED = "SELECT COUNT(*) FROM sys.tables tb WHERE tb.is_tracked_by_cdc = 1 AND tb.name='#'";
|
|
|
- private static final String ENABLE_DB_CDC = "IF EXISTS(select 1 from sys.databases where name = '#' AND is_cdc_enabled=0) EXEC sys.sp_cdc_enable_db";
|
|
|
- private static final String ENABLE_TABLE_CDC = "IF EXISTS(select 1 from sys.tables where name = '#' AND is_tracked_by_cdc=0) EXEC sys.sp_cdc_enable_table @source_schema = N'%s', @source_name = N'#', @role_name = NULL, @supports_net_changes = 0";
|
|
|
+ private static final String GET_DATABASE_NAME = "select db_name()";
|
|
|
+ private static final String GET_TABLE_LIST = "select name from sys.tables where schema_id = schema_id('#') and is_ms_shipped = 0";
|
|
|
+ private static final String IS_DB_CDC_ENABLED = "select is_cdc_enabled from sys.databases where name = '#'";
|
|
|
+ private static final String IS_TABLE_CDC_ENABLED = "select count(*) from sys.tables tb where tb.is_tracked_by_cdc = 1 and tb.name='#'";
|
|
|
+ private static final String ENABLE_DB_CDC = "IF EXISTS(select 1 from sys.databases where name = '#' and is_cdc_enabled=0) EXEC sys.sp_cdc_enable_db";
|
|
|
+ private static final String ENABLE_TABLE_CDC = "IF EXISTS(select 1 from sys.tables where name = '#' and is_tracked_by_cdc=0) EXEC sys.sp_cdc_enable_table @source_schema = N'%s', @source_name = N'#', @role_name = NULL, @supports_net_changes = 0";
|
|
|
private static final String GET_TABLES_CDC_ENABLED = "EXEC sys.sp_cdc_help_change_data_capture";
|
|
|
- private static final String GET_MAX_LSN = "SELECT sys.fn_cdc_get_max_lsn()";
|
|
|
- private static final String GET_MIN_LSN = "SELECT sys.fn_cdc_get_min_lsn('#')";
|
|
|
- private static final String GET_INCREMENT_LSN = "SELECT sys.fn_cdc_increment_lsn(?)";
|
|
|
- private static final String GET_ALL_CHANGES_FOR_TABLE = "SELECT * FROM cdc.[fn_cdc_get_all_changes_#](?, ?, N'all update old') order by [__$start_lsn] ASC, [__$seqval] ASC, [__$operation] ASC";
|
|
|
+ private static final String GET_MAX_LSN = "select sys.fn_cdc_get_max_lsn()";
|
|
|
+ private static final String GET_MIN_LSN = "select sys.fn_cdc_get_min_lsn('#')";
|
|
|
+ private static final String GET_INCREMENT_LSN = "select sys.fn_cdc_increment_lsn(?)";
|
|
|
+ private static final String GET_ALL_CHANGES_FOR_TABLE = "select * from cdc.[fn_cdc_get_all_changes_#](?, ?, N'all update old') order by [__$start_lsn] ASC, [__$seqval] ASC, [__$operation] ASC";
|
|
|
|
|
|
private static final String LSN_POSITION = "position";
|
|
|
private static final int OFFSET_COLUMNS = 4;
|