Skip to content

Commit

Permalink
Merge branch '3.8' of https://github.com/JumpMind/symmetric-ds into 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
klementinastojanovska committed Nov 14, 2017
2 parents c9365e1 + 1f5e294 commit 7dfd584
Show file tree
Hide file tree
Showing 8 changed files with 327 additions and 187 deletions.
31 changes: 20 additions & 11 deletions symmetric-assemble/asciidoc.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,30 @@ task generateAppendixes {
}
}

ext.getDocDir = {
if (project.properties.containsKey('pro')) {
return file("$buildDir/../../../symmetric-pro/symmetric-pro/src/main/resources/VAADIN/doc")
} else {
return file("$buildDir/doc")
}
}

task cleanDocs {
dependsOn asciidoctor
def destinationDir = getDocDir()
doFirst {
println "Deleting $destinationDir.path"
delete destinationDir
}
}

task generateDocs(type: Copy) {

dependsOn asciidoctor
dependsOn cleanDocs
group = 'SymmetricDS'
description = 'Generates user manual and documentation'

destinationDir = file("$buildDir/doc")
if (project.properties.containsKey('pro')) {
destinationDir = file("$buildDir/../../../symmetric-pro/symmetric-pro/src/main/resources/VAADIN/doc")
}
destinationDir = getDocDir()

into('html') {
from ("$buildDir/src/asciidoc/html5") { include "user-guide.html" }
Expand Down Expand Up @@ -113,12 +127,7 @@ task generateDocs(type: Copy) {

into('pdf') {
from ("$buildDir/src/asciidoc/pdf/operations") { include "operations.pdf" }
}

doFirst {
println "Deleting $destinationDir.path"
delete destinationDir
}
}

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
Expand Down Expand Up @@ -27,6 +26,7 @@
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.commons.io.IOUtils;
import org.jumpmind.db.platform.IDatabasePlatform;
import org.jumpmind.db.sql.IConnectionCallback;
import org.jumpmind.db.sql.ISqlTransaction;
Expand Down Expand Up @@ -125,7 +125,7 @@ public BinaryEncoding getBinaryEncoding() {
}

@Override
protected boolean doesTriggerExistOnPlatform(final String catalogName, String schema, String tableName,
protected boolean doesTriggerExistOnPlatform(final String catalogName, final String schema, final String tableName,
final String triggerName) {
return ((JdbcSqlTemplate) platform.getSqlTemplate())
.execute(new IConnectionCallback<Boolean>() {
Expand All @@ -138,7 +138,33 @@ public Boolean execute(Connection con) throws SQLException {
con.setCatalog(catalogName);
}
stmt.setString(1, triggerName);
ResultSet rs = stmt.executeQuery();
ResultSet rs = null;
try {
rs = stmt.executeQuery();
} catch (Exception ex) {
try {
stmt.close();
} catch (Exception exClose) {
log.debug("Falied to close stmt", exClose);
}
if (catalogName != null) {
log.info("Tried: select count(*) from dbo.sysobjects where type = 'TR' AND name ='{}' which failed, will try again with catalog.", triggerName);
// try again with the source catalog prefixed.
try {
PreparedStatement stmt2 = con
.prepareStatement(String.format("select count(*) from %s.dbo.sysobjects where type = 'TR' AND name = ?", catalogName));
stmt2.setString(1, triggerName);
log.debug(String.format("TRY AGAIN Exceute: select count(*) from %s.dbo.sysobjects where type = 'TR' AND name ='%s'", catalogName, triggerName));
rs = stmt2.executeQuery();
} catch (Exception ex2) {
log.error(String.format("Failed again with catalog... select count(*) from %s.dbo.sysobjects where type = 'TR' AND name = '%s'", catalogName, triggerName), ex2);
throw new RuntimeException(String.format("Detect trigger query failed. select count(*) from dbo.sysobjects where type = 'TR' AND name ='%s'", triggerName), ex);
}
} else {
throw new RuntimeException(String.format("Detect trigger query failed. select count(*) from dbo.sysobjects where type = 'TR' AND name ='%s'", triggerName), ex);
}

}
if (rs.next()) {
int count = rs.getInt(1);
return count > 0;
Expand Down
Loading

0 comments on commit 7dfd584

Please sign in to comment.