Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'origin/3.10' into 3.11
Conflicts:
	symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java
	symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/writer/DefaultDatabaseWriterConflictResolver.java
  • Loading branch information
erilong committed Sep 30, 2019
2 parents ddee92e + 8f7cd8c commit d691e21
Show file tree
Hide file tree
Showing 91 changed files with 1,589 additions and 356 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,2 +1,5 @@
/.DS_Store
/.project
*.iml

/.idea/*
10 changes: 9 additions & 1 deletion symmetric-assemble/common.gradle
Expand Up @@ -8,6 +8,14 @@ configurations {
sshAntTask
}

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.ow2.asm') {
details.useVersion '5.0.3'
}
}
}

dependencies {
sshAntTask 'org.apache.ant:ant-jsch:1.10.5', 'com.jcraft:jsch:0.1.55'
}
Expand Down Expand Up @@ -213,7 +221,7 @@ subprojects { subproject ->
voltDbVersion = '8.4.1'
bouncyCastleVersion = '1.59'
animalSnifferVersion = '1.10'
jnaVersion = '4.2.0'
jnaVersion = '4.5.0'
jettyVersion = project.property('jetty.version')
nuodbVersion = '3.3.1'
tiberoVersion = '6'
Expand Down
4 changes: 2 additions & 2 deletions symmetric-assemble/gradle.properties
Expand Up @@ -11,5 +11,5 @@ publishPort=?
publishServer=symmetricds.org
sourceforgeUser=?
sourceforgePassword=?
jetty.version=9.4.7.v20170914
vaadinVersion=8.7.1
jetty.version=9.4.19.v20190610
vaadinVersion=8.7.1
2 changes: 1 addition & 1 deletion symmetric-assemble/src/asciidoc/appendix/dbcompare.ad
Expand Up @@ -59,7 +59,7 @@ image::appendix/dbcompare/dbcompare-config.png[width=1000]
- *--output-sql <arg>* : An output file for SQL statements that if executed on the target, should bring it into sync with the source.
- *-s, --source* : The source database engine properties file for comparison.
- *-t, --target <arg>* : The target database engine properties file for comparison.
- *--use-sym-config <arg>* : true|false. If true, sym_trigger, sym_transform, etc. will be consulted to build up the data model to compare. Default is true.
- *--use-sym-config <arg>* : true|false. If true, sym_trigger, sym_transform, etc. will be consulted to build up the data model to compare, and the tablename argument is no longer required, but if tablename is provided it will only compare the matching tables. Default is false.

An example DbCompare results table is shown below:

Expand Down
6 changes: 4 additions & 2 deletions symmetric-assemble/src/asciidoc/configuration/routers/csv.ad
Expand Up @@ -10,16 +10,18 @@ image::csv-router.png[]

endif::pro[]

In your router expression you can tell the router to include a transaction ID for the routed data with INCLUDE_TRANSACTION_ID=true|false. Default is false.

ifndef::pro[]

.The following SQL statement defines a router that will send data from a CSV file to table1 in the 'corp' node group.
[source, SQL]
----
insert into SYM_ROUTER (router_id, target_table_name,
source_node_group_id, target_node_group_id, router_type,
create_time, last_update_time) values
router_expression, create_time, last_update_time) values
('store-2-corp-csv','table1','store', 'corp', 'csv',
current_timestamp, current_timestamp);
'INCLUDE_TRANSACTION_ID=true', current_timestamp, current_timestamp);
----

endif::pro[]
Expand Down
Expand Up @@ -13,7 +13,8 @@ tables. If another trigger already exists for a table, then that table is not in
trigger entry take precedence).
* System tables and any table names that start with the SymmetricDS table prefix will be excluded.
* To negate the expression and exclude tables, start the expression with an exclamation.
* Double up special characters to match a single literal character. (Use two asterisks to match a single asterisk.)
* Double up special characters to match a single literal character. (Use two asterisks to match a single asterisk.)
The entire expression is processed as wildcarded when an odd number of consecutive special characters are found.

ifdef::pro[]
.Sample wildcard trigger for all tables that start with "sale" or " item"
Expand Down
Expand Up @@ -20,6 +20,10 @@
*/
package org.jumpmind.symmetric;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
import org.apache.commons.dbcp.BasicDataSource;
Expand All @@ -28,6 +32,9 @@
public class DbSqlCommand extends AbstractCommandLauncher {

private static final String OPTION_SQL = "sql";
private static final String OPTION_SQLFILE = "sqlfile";

private Options localOptions;

public DbSqlCommand() {
super("dbsql", "", "DbSql.Option.");
Expand All @@ -48,6 +55,9 @@ protected void printHelp(CommandLine cmd, Options options) {
protected void buildOptions(Options options) {
super.buildOptions(options);
addOption(options, null, OPTION_SQL, true);
addOption(options, null, OPTION_SQLFILE, true);
// Need reference to it for later, if errors
localOptions = options;
}

@Override
Expand All @@ -72,6 +82,37 @@ protected boolean executeWithOptions(CommandLine line) throws Exception {
if (line.hasOption(OPTION_SQL)) {
String sql = line.getOptionValue(OPTION_SQL);
shell.runTool("-url", url, "-user", user, "-password", password, "-driver", driver, "-sql", sql);
} else if(line.hasOption(OPTION_SQLFILE)) {
File file = new File(line.getOptionValue(OPTION_SQLFILE));
if(file.exists()) {
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
String sql = null;
while((sql = br.readLine()) != null) {
sql = sql.trim();
if(sql.endsWith(";")) {
sql = sql.substring(0,sql.length()-1);
}
if(sql.length() > 0) {
// Output the sql so the user knows the result of each sql statement
// The H2 shell tool outputs the result of the statement execution
System.out.println(sql);
shell.runTool("-url", url, "-user", user, "-password", password, "-driver", driver, "-sql", sql);
}
}
} finally {
if(br != null) {
br.close();
}
}
} else {
// Notify user about missing file name
System.err.println("-------------------------------------------------------------------------------");
System.err.println("File does not exist: " + file.getPath());
System.err.println("-------------------------------------------------------------------------------");
printHelp(line, localOptions);
}
} else {
shell.runTool("-url", url, "-user", user, "-password", password, "-driver", driver);
}
Expand Down
Expand Up @@ -230,9 +230,11 @@ private void printHelpCommand(CommandLine line) {
addOption(options, "n", OPTION_NODE, true);
addOption(options, "g", OPTION_NODE_GROUP, true);
}
if (cmd.equals(CMD_RELOAD_TABLE)) {
if (cmd.equals(CMD_RELOAD_TABLE) || cmd.equals(CMD_SYNC_TRIGGERS) || cmd.equals(CMD_SEND_SQL) || cmd.equals(CMD_SEND_SCHEMA)) {
addOption(options, "c", OPTION_CATALOG, true);
addOption(options, "s", OPTION_SCHEMA, true);
}
if (cmd.equals(CMD_RELOAD_TABLE)) {
addOption(options, "w", OPTION_WHERE, true);
}
if (cmd.equals(CMD_SYNC_TRIGGERS)) {
Expand Down Expand Up @@ -264,9 +266,7 @@ private void printHelpCommand(CommandLine line) {
}
writer.flush();
}
}


}

@Override
protected void buildOptions(Options options) {
Expand Down
Expand Up @@ -50,7 +50,7 @@
abstract public class AbstractEmbeddedTrigger {

protected static final char[] HEX = "0123456789abcdef".toCharArray();
protected static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
protected static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
protected static final String KEY_CONDITION_SQL = "CONDITION_SQL";
protected static final String KEY_INSERT_DATA_SQL = "INSERT_DATA_SQL";
protected static final String TEMPLATE_TABLE_SUFFIX = "_CONFIG";
Expand Down
Expand Up @@ -149,7 +149,7 @@ public ISymmetricDialect create() {
int dbMinorVersion = platform.getSqlTemplate().getDatabaseMinorVersion();
if (dbMajorVersion == 2 && dbMinorVersion == 0) {
dialect = new Firebird20SymmetricDialect(parameterService, platform);
} else if (dbMajorVersion == 2) {
} else if (dbMajorVersion >= 2) {
dialect = new Firebird21SymmetricDialect(parameterService, platform);
} else {
dialect = new FirebirdSymmetricDialect(parameterService, platform);
Expand Down
Expand Up @@ -33,7 +33,7 @@ public H2TriggerTemplate(ISymmetricDialect symmetricDialect) {
emptyColumnTemplate = "''''" ;
stringColumnTemplate = "case when $(tableAlias)\"$(columnName)\" is null then '''' else ''\"''||replace(replace($(tableAlias)\"$(columnName)\",''\\'',''\\\\''),''\"'',''\\\"'')||''\"'' end" ;
numberColumnTemplate = "case when $(tableAlias)\"$(columnName)\" is null then '''' else ''\"''||cast($(tableAlias)\"$(columnName)\" as varchar(50))||''\"'' end" ;
datetimeColumnTemplate = "case when $(tableAlias)\"$(columnName)\" is null then '''' else ''\"''||formatdatetime($(tableAlias)\"$(columnName)\", ''yyyy-MM-dd HH:mm:ss.S'')||''\"'' end" ;
datetimeColumnTemplate = "case when $(tableAlias)\"$(columnName)\" is null then '''' else ''\"''||formatdatetime($(tableAlias)\"$(columnName)\", ''yyyy-MM-dd HH:mm:ss.SSS'')||''\"'' end" ;
clobColumnTemplate = "case when $(tableAlias)\"$(columnName)\" is null then '''' else ''\"''||replace(replace($(tableAlias)\"$(columnName)\",''\\'',''\\\\''),''\"'',''\\\"'')||''\"'' end" ;
blobColumnTemplate = "case when $(tableAlias)\"$(columnName)\" is null then '''' else ''\"''||replace(replace(sym_BASE64_ENCODE($(tableAlias)\"$(columnName)\"),''\\'',''\\\\''),''\"'',''\\\"'')||''\"'' end" ;
booleanColumnTemplate = "case when $(tableAlias)\"$(columnName)\" is null then '''' when $(tableAlias)\"$(columnName)\" then ''\"1\"'' else ''\"0\"'' end" ;
Expand Down

0 comments on commit d691e21

Please sign in to comment.