Skip to content

Commit

Permalink
0005805: Allow specification of database platform of symmetric when
Browse files Browse the repository at this point in the history
DbDxport execution with load only/extract only/log miner
  • Loading branch information
Philip Marzullo committed Apr 20, 2023
1 parent 87a2174 commit a58df62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Expand Up @@ -271,18 +271,24 @@ protected void testConnection() {
}

protected IDatabasePlatform getDatabasePlatform(boolean testConnection) {
return getDatabasePlatform(testConnection, false);
}

protected IDatabasePlatform getDatabasePlatform(boolean testConnection, boolean symmetricPlatform) {
if (platform == null) {
if (testConnection) {
testConnection();
}
ITypedPropertiesFactory factory = PropertiesUtil.createTypedPropertiesFactory(propertiesFile, null);
TypedProperties properties = factory.reload(propertiesFile);
if (properties.is(ParameterConstants.NODE_LOAD_ONLY, false)) {
TypedProperties copiedProperties = new TypedProperties();
String prefix = ParameterConstants.LOAD_ONLY_PROPERTY_PREFIX;
copyProperties(properties, copiedProperties, prefix, BasicDataSourcePropertyConstants.ALL_PROPS);
copyProperties(properties, copiedProperties, prefix, ParameterConstants.ALL_JDBC_PARAMS);
properties = copiedProperties;
if (!symmetricPlatform) {
TypedProperties copiedProperties = new TypedProperties();
String prefix = ParameterConstants.LOAD_ONLY_PROPERTY_PREFIX;
copyProperties(properties, copiedProperties, prefix, BasicDataSourcePropertyConstants.ALL_PROPS);
copyProperties(properties, copiedProperties, prefix, ParameterConstants.ALL_JDBC_PARAMS);
properties = copiedProperties;
}
}
platform = ClientSymmetricEngine.createDatabasePlatform(null, properties, null, false);
}
Expand Down
Expand Up @@ -51,6 +51,7 @@ public class DbExportCommand extends AbstractCommandLauncher {
private static final String OPTION_DIR = "dir";
private static final String OPTION_WHERE = "where";
private static final String OPTION_EXCLUDE_COLUMNS = "exclude-columns";
private static final String OPTION_SYMMETRIC_PLATFORM = "symmetric";

public DbExportCommand() {
super("dbexport", "[tablename...]", "DbExport.Option.");
Expand Down Expand Up @@ -97,11 +98,12 @@ protected void buildOptions(Options options) {
addOption(options, null, OPTION_WHERE, true);
addOption(options, "i", OPTION_COMMENTS, false);
addOption(options, null, OPTION_EXCLUDE_COLUMNS, true);
addOption(options, null, OPTION_SYMMETRIC_PLATFORM, false);
}

@Override
protected boolean executeWithOptions(CommandLine line) throws Exception {
DbExport dbExport = new DbExport(getDatabasePlatform(false));
DbExport dbExport = new DbExport(getDatabasePlatform(false, line.hasOption(OPTION_SYMMETRIC_PLATFORM)));
if (line.hasOption(OPTION_DIR)) {
String dir = line.getOptionValue(OPTION_DIR);
if (new File(dir).exists()) {
Expand Down

0 comments on commit a58df62

Please sign in to comment.