Skip to content

Commit

Permalink
0002713: Added feature to incorporate DB Compare into SQL Explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
sunderrd committed Aug 10, 2016
1 parent b8c3836 commit f8d219d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Expand Up @@ -72,6 +72,7 @@ public class TableConstants {
public static final String SYM_FILE_SNAPSHOT = "file_snapshot";
public static final String SYM_FILE_INCOMING = "file_incoming";
public static final String SYM_CONSOLE_USER = "console_user";
public static final String SYM_CONSOLE_EVENT = "console_event";
public static final String SYM_EXTENSION = "extension";
public static final String SYM_MONITOR = "monitor";
public static final String SYM_MONITOR_EVENT = "monitor_event";
Expand Down Expand Up @@ -181,6 +182,8 @@ protected static List<String> populateAllTables(String tablePrefix) {
tables.add(getTableName(tablePrefix, TableConstants.SYM_FILE_TRIGGER_ROUTER));
tables.add(getTableName(tablePrefix, TableConstants.SYM_FILE_SNAPSHOT));
tables.add(getTableName(tablePrefix, TableConstants.SYM_FILE_INCOMING));
tables.add(getTableName(tablePrefix, SYM_CONSOLE_USER));
tables.add(getTableName(tablePrefix, SYM_CONSOLE_EVENT));
tables.add(getTableName(tablePrefix, SYM_EXTENSION));
tables.add(getTableName(tablePrefix, SYM_MONITOR));
tables.add(getTableName(tablePrefix, SYM_MONITOR_EVENT));
Expand Down
Expand Up @@ -112,6 +112,32 @@ public DbCompareReport compare() {

return report;
}

public List<TableReport> compareForList() {
dbValueComparator.setNumericScale(numericScale);
List<TableReport> list = new ArrayList<TableReport>();
long start = System.currentTimeMillis();
List<DbCompareTables> tablesToCompare = getTablesToCompare();

for (DbCompareTables tables : tablesToCompare) {
try {
TableReport tableReport = compareTables(tables);
list.add(tableReport);
long elapsed = System.currentTimeMillis() - start;
log.info("Completed table {}. Elapsed time: {}", tableReport,
DurationFormatUtils.formatDurationWords((elapsed), true, true));
} catch (Exception e) {
log.error("Exception while comparing " + tables.getSourceTable() +
" to " + tables.getTargetTable(), e);
}
}

long totalTime = System.currentTimeMillis() - start;
log.info("dbcompare complete. Total Time: {}",
DurationFormatUtils.formatDurationWords((totalTime), true, true));

return list;
}

protected TableReport compareTables(DbCompareTables tables) {
String sourceSelect = getSourceComparisonSQL(tables, sourceEngine.getDatabasePlatform());
Expand Down

0 comments on commit f8d219d

Please sign in to comment.