diff --git a/.classpath b/.classpath index f619a53..5e8a55f 100644 --- a/.classpath +++ b/.classpath @@ -10,9 +10,10 @@ + - + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 6249222..db24ee7 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,15 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/pom.xml b/pom.xml index 8e7dbd3..11aba64 100644 --- a/pom.xml +++ b/pom.xml @@ -3,6 +3,7 @@ 4.0.0 de.jlo.talendcomp jlo-talendcomp-tabletransfer + 9.5 Talend Table Transfer Components Jan Lolling @@ -12,6 +13,7 @@ org.apache.maven.plugins maven-compiler-plugin + 3.8.1 1.8 1.8 @@ -24,7 +26,7 @@ ${project.basedir}/talend_component ${project.basedir}/talend_component - /Data/Talend/Studio/talend_user_components + ${custom_component_folder} @@ -88,18 +90,5 @@ 4.12 test - - mysql - mysql-connector-java - 5.1.6 - provided - - - org.postgresql - postgresql - 9.4.1212.jre7 - provided - - 9.4 \ No newline at end of file diff --git a/src/main/java/de/jlo/datamodel/generator/MysqlSQLCodeGenerator.java b/src/main/java/de/jlo/datamodel/generator/MysqlSQLCodeGenerator.java index 7f63519..6a9a3f6 100644 --- a/src/main/java/de/jlo/datamodel/generator/MysqlSQLCodeGenerator.java +++ b/src/main/java/de/jlo/datamodel/generator/MysqlSQLCodeGenerator.java @@ -13,7 +13,11 @@ public SQLStatement buildPSInsertSQLStatement(SQLTable table, boolean fullName, sqlPs.setPrepared(true); int paramIndex = 0; final StringBuilder sb = new StringBuilder(); - sb.append("insert into "); + if (onConflictIgnore) { + sb.append("insert ignore into "); + } else { + sb.append("insert into "); + } if (fullName) { sb.append(getEncapsulatedName(table.getAbsoluteName())); } else { @@ -47,14 +51,7 @@ public SQLStatement buildPSInsertSQLStatement(SQLTable table, boolean fullName, sqlPs.addParam(psParam); } sb.append(")"); - if (onConflictIgnore || (hasNonePrimaryKeyFields == false)) { - sb.append("\n on duplicate key update "); - // build dummy assignment col=col - field = table.getFieldAt(0); - sb.append(field.getName()); - sb.append("="); - sb.append(field.getName()); - } else if (onConflictUpdate && hasNonePrimaryKeyFields) { + if (onConflictUpdate && hasNonePrimaryKeyFields) { sb.append("\n on duplicate key update "); // build assignment for the none-key fields boolean firstLoop = true; diff --git a/src/main/java/de/jlo/talendcomp/tabletransfer/MySQLHelper.java b/src/main/java/de/jlo/talendcomp/tabletransfer/MySQLHelper.java index bd3eb38..8058f75 100644 --- a/src/main/java/de/jlo/talendcomp/tabletransfer/MySQLHelper.java +++ b/src/main/java/de/jlo/talendcomp/tabletransfer/MySQLHelper.java @@ -8,26 +8,26 @@ public class MySQLHelper extends DBHelper { private void enableStreaming(java.sql.Statement stmt) throws Exception { if (stmt != null) { Class stmtClass = stmt.getClass(); - if (stmt instanceof com.mysql.jdbc.Statement) { - ((com.mysql.jdbc.Statement) stmt).enableStreamingResults(); - } else if (stmtClass.getName().equals("org.apache.commons.dbcp2.DelegatingPreparedStatement")) { - Method method = stmtClass.getMethod("getDelegate", (Class[]) null); - Object result = method.invoke(stmt, (Object[]) null); - if (result instanceof java.sql.Statement) { - enableStreaming((java.sql.Statement) result); - } else { - System.err.println("Got no statement object. Instead we got: " + result); - } - } else if (stmtClass.getName().equals("org.apache.commons.dbcp2.DelegatingStatement")) { - Method method = stmtClass.getMethod("getDelegate", (Class[]) null); - Object result = method.invoke(stmt, (Object[]) null); - if (result instanceof java.sql.Statement) { - enableStreaming((java.sql.Statement) result); - } else { - System.err.println("Got no statement object. Instead we got: " + result); + boolean enablingSucceeded = false; + try { + Method method = stmtClass.getMethod("enableStreamingResults", (Class[]) null); + method.invoke(stmt, (Object[]) null); + enablingSucceeded = true; + } catch (NoSuchMethodException nsme) { + // ignore intentionally + } + if (enablingSucceeded == false) { + // because it is a wrapper class from pools e.g. + try { + // most likely we will get the actual statement by fetching the delegate + Method method = stmtClass.getMethod("getDelegate", (Class[]) null); + Object result = method.invoke(stmt, (Object[]) null); + if (result instanceof java.sql.Statement) { + enableStreaming((java.sql.Statement) result); + } + } catch (NoSuchMethodException nsme) { + // ignore intentionally } - } else { - System.err.println("Incompatible statement class found: " + stmt.getClass().getName()); } } } diff --git a/talend_component/tDB2TableTransfer/jlo-talendcomp-tabletransfer-9.4.jar b/talend_component/tDB2TableTransfer/jlo-talendcomp-tabletransfer-9.4.jar deleted file mode 100644 index 4882343..0000000 Binary files a/talend_component/tDB2TableTransfer/jlo-talendcomp-tabletransfer-9.4.jar and /dev/null differ diff --git a/talend_component/tDB2TableTransfer/jlo-talendcomp-tabletransfer-9.5.jar b/talend_component/tDB2TableTransfer/jlo-talendcomp-tabletransfer-9.5.jar new file mode 100644 index 0000000..3fb050a Binary files /dev/null and b/talend_component/tDB2TableTransfer/jlo-talendcomp-tabletransfer-9.5.jar differ diff --git a/talend_component/tDB2TableTransfer/tDB2TableTransfer_java.xml b/talend_component/tDB2TableTransfer/tDB2TableTransfer_java.xml index 2240b62..a80f2ef 100644 --- a/talend_component/tDB2TableTransfer/tDB2TableTransfer_java.xml +++ b/talend_component/tDB2TableTransfer/tDB2TableTransfer_java.xml @@ -1,7 +1,7 @@ -
+
@@ -148,13 +148,13 @@ - - Release: 9.4 build at: 20200804 + + Release: 9.5 build at: 20210929 - + diff --git a/talend_component/tEXATableTransfer/jlo-talendcomp-tabletransfer-9.4.jar b/talend_component/tEXATableTransfer/jlo-talendcomp-tabletransfer-9.4.jar deleted file mode 100644 index 4882343..0000000 Binary files a/talend_component/tEXATableTransfer/jlo-talendcomp-tabletransfer-9.4.jar and /dev/null differ diff --git a/talend_component/tEXATableTransfer/jlo-talendcomp-tabletransfer-9.5.jar b/talend_component/tEXATableTransfer/jlo-talendcomp-tabletransfer-9.5.jar new file mode 100644 index 0000000..4dda1f7 Binary files /dev/null and b/talend_component/tEXATableTransfer/jlo-talendcomp-tabletransfer-9.5.jar differ diff --git a/talend_component/tEXATableTransfer/tEXATableTransfer_java.xml b/talend_component/tEXATableTransfer/tEXATableTransfer_java.xml index cf2151a..205eae7 100644 --- a/talend_component/tEXATableTransfer/tEXATableTransfer_java.xml +++ b/talend_component/tEXATableTransfer/tEXATableTransfer_java.xml @@ -1,7 +1,7 @@ -
+
@@ -148,13 +148,13 @@ - - Release: 9.4 build at: 20200804 + + Release: 9.5 build at: 20210929 - + diff --git a/talend_component/tMysqlTableTransfer/jlo-talendcomp-tabletransfer-9.4.jar b/talend_component/tMysqlTableTransfer/jlo-talendcomp-tabletransfer-9.4.jar deleted file mode 100644 index 4882343..0000000 Binary files a/talend_component/tMysqlTableTransfer/jlo-talendcomp-tabletransfer-9.4.jar and /dev/null differ diff --git a/talend_component/tMysqlTableTransfer/jlo-talendcomp-tabletransfer-9.5.jar b/talend_component/tMysqlTableTransfer/jlo-talendcomp-tabletransfer-9.5.jar new file mode 100644 index 0000000..4dda1f7 Binary files /dev/null and b/talend_component/tMysqlTableTransfer/jlo-talendcomp-tabletransfer-9.5.jar differ diff --git a/talend_component/tMysqlTableTransfer/tMysqlTableTransfer_begin.javajet b/talend_component/tMysqlTableTransfer/tMysqlTableTransfer_begin.javajet index 6199880..447b6e9 100644 --- a/talend_component/tMysqlTableTransfer/tMysqlTableTransfer_begin.javajet +++ b/talend_component/tMysqlTableTransfer/tMysqlTableTransfer_begin.javajet @@ -192,11 +192,11 @@ System.out.println("Source query statement:" + <%=cid%>.getSourceQuery()); <% } %> <% if (outputToTable && "true".equalsIgnoreCase(logoutInsert)) { %> - // log target statement + // log target statement System.out.println("Target insert statement:" + <%=cid%>.getTargetInsertStatement()); <% } %> <% if (outputToTable && "true".equalsIgnoreCase(truncateTarget)) { %> - System.out.println("truncate target table..."); + System.out.println("truncate target table..."); <%=cid%>.executeSQLOnTarget("truncate table " + <%=cid%>.getTargetTable()); <% } %> <% if (outputToTable && "true".equalsIgnoreCase(disableKeys)) { %> diff --git a/talend_component/tMysqlTableTransfer/tMysqlTableTransfer_java.xml b/talend_component/tMysqlTableTransfer/tMysqlTableTransfer_java.xml index c7c55a0..ce58a4f 100644 --- a/talend_component/tMysqlTableTransfer/tMysqlTableTransfer_java.xml +++ b/talend_component/tMysqlTableTransfer/tMysqlTableTransfer_java.xml @@ -1,7 +1,7 @@ -
+
@@ -158,13 +158,13 @@ - - Release: 9.4 build at: 20200804 + + Release: 9.5 build at: 20210929 - + diff --git a/talend_component/tOracleTableTransfer/jlo-talendcomp-tabletransfer-9.4.jar b/talend_component/tOracleTableTransfer/jlo-talendcomp-tabletransfer-9.4.jar deleted file mode 100644 index 4882343..0000000 Binary files a/talend_component/tOracleTableTransfer/jlo-talendcomp-tabletransfer-9.4.jar and /dev/null differ diff --git a/talend_component/tOracleTableTransfer/jlo-talendcomp-tabletransfer-9.5.jar b/talend_component/tOracleTableTransfer/jlo-talendcomp-tabletransfer-9.5.jar new file mode 100644 index 0000000..96fa6f0 Binary files /dev/null and b/talend_component/tOracleTableTransfer/jlo-talendcomp-tabletransfer-9.5.jar differ diff --git a/talend_component/tOracleTableTransfer/tOracleTableTransfer_java.xml b/talend_component/tOracleTableTransfer/tOracleTableTransfer_java.xml index 2f726e5..6ab98f4 100644 --- a/talend_component/tOracleTableTransfer/tOracleTableTransfer_java.xml +++ b/talend_component/tOracleTableTransfer/tOracleTableTransfer_java.xml @@ -1,7 +1,7 @@ -
+
@@ -148,13 +148,13 @@ - - Release: 9.4 build at: 20200804 + + Release: 9.5 build at: 20210929 - + diff --git a/talend_component/tPostgresqlTableTransfer/jlo-talendcomp-tabletransfer-9.4.jar b/talend_component/tPostgresqlTableTransfer/jlo-talendcomp-tabletransfer-9.4.jar deleted file mode 100644 index 4882343..0000000 Binary files a/talend_component/tPostgresqlTableTransfer/jlo-talendcomp-tabletransfer-9.4.jar and /dev/null differ diff --git a/talend_component/tPostgresqlTableTransfer/jlo-talendcomp-tabletransfer-9.5.jar b/talend_component/tPostgresqlTableTransfer/jlo-talendcomp-tabletransfer-9.5.jar new file mode 100644 index 0000000..96fa6f0 Binary files /dev/null and b/talend_component/tPostgresqlTableTransfer/jlo-talendcomp-tabletransfer-9.5.jar differ diff --git a/talend_component/tPostgresqlTableTransfer/tPostgresqlTableTransfer_java.xml b/talend_component/tPostgresqlTableTransfer/tPostgresqlTableTransfer_java.xml index 4094021..1274136 100644 --- a/talend_component/tPostgresqlTableTransfer/tPostgresqlTableTransfer_java.xml +++ b/talend_component/tPostgresqlTableTransfer/tPostgresqlTableTransfer_java.xml @@ -1,7 +1,7 @@ -
+
@@ -155,13 +155,13 @@ - - Release: 9.4 build at: 20200804 + + Release: 9.5 build at: 20210929 - +