From f09a06dea241c3e48d5336e3ebdee5085f51da65 Mon Sep 17 00:00:00 2001 From: inrgihc Date: Sun, 7 Feb 2021 16:54:52 +0800 Subject: [PATCH] =?UTF-8?q?!42=20BUG=E4=BF=AE=E5=A4=8D=20*=20=E8=B0=83?= =?UTF-8?q?=E5=A4=A7java=E5=A0=86=E5=86=85=E5=AD=98=E5=8F=82=E6=95=B0=20*?= =?UTF-8?q?=20Fix:=20MySQL8=E8=BD=ACPostgres=E7=9A=84=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E7=B1=BB=E5=9E=8B=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbswitch-common/pom.xml | 2 +- dbswitch-core/pom.xml | 2 +- .../com/gitee/dbswitch/core/database/AbstractDatabase.java | 5 +++-- .../dbswitch/core/database/impl/DatabaseGreenplumImpl.java | 6 +++++- .../dbswitch/core/database/impl/DatabasePostgresImpl.java | 6 +++++- dbswitch-data/pom.xml | 2 +- dbswitch-dbchange/pom.xml | 2 +- dbswitch-dbcommon/pom.xml | 2 +- dbswitch-dbsynch/pom.xml | 2 +- dbswitch-dbwriter/pom.xml | 2 +- dbswitch-pgwriter/pom.xml | 2 +- dbswitch-sql/pom.xml | 2 +- dbswitch-webapi/pom.xml | 2 +- package-tool/pom.xml | 2 +- package-tool/src/main/assembly/bin/datasync.sh | 2 +- pom.xml | 2 +- version.cmd | 2 +- 17 files changed, 27 insertions(+), 18 deletions(-) diff --git a/dbswitch-common/pom.xml b/dbswitch-common/pom.xml index f0ceb467..a970a7fe 100644 --- a/dbswitch-common/pom.xml +++ b/dbswitch-common/pom.xml @@ -5,7 +5,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 dbswitch-common diff --git a/dbswitch-core/pom.xml b/dbswitch-core/pom.xml index 02deaedb..7f238b88 100644 --- a/dbswitch-core/pom.xml +++ b/dbswitch-core/pom.xml @@ -5,7 +5,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 dbswitch-core diff --git a/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/AbstractDatabase.java b/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/AbstractDatabase.java index 89cd82d9..2ebdd54d 100644 --- a/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/AbstractDatabase.java +++ b/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/AbstractDatabase.java @@ -18,6 +18,7 @@ import java.util.HashSet; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; +import java.sql.Statement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; @@ -217,8 +218,8 @@ public abstract class AbstractDatabase implements IDatabaseInterface { @Override public void testQuerySQL(String sql) { String wrapperSql = this.getTestQuerySQL(sql); - try(PreparedStatement pstmt = this.connection.prepareStatement(wrapperSql);) { - pstmt.executeQuery(); + try (Statement statement = this.connection.createStatement();) { + statement.execute(wrapperSql); } catch (SQLException e) { throw new RuntimeException(e); } diff --git a/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/impl/DatabaseGreenplumImpl.java b/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/impl/DatabaseGreenplumImpl.java index a436238d..10995831 100644 --- a/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/impl/DatabaseGreenplumImpl.java +++ b/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/impl/DatabaseGreenplumImpl.java @@ -112,7 +112,11 @@ public class DatabaseGreenplumImpl extends AbstractDatabase implements IDatabase if (length < 1 || length >= AbstractDatabase.CLOB_LENGTH) { retval += "TEXT"; } else { - retval += "VARCHAR(" + length + ")"; + if (null != pks && pks.contains(fieldname)) { + retval += "VARCHAR(" + length + ")"; + } else { + retval += "TEXT"; + } } break; case ColumnMetaData.TYPE_BINARY: diff --git a/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/impl/DatabasePostgresImpl.java b/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/impl/DatabasePostgresImpl.java index 891a405d..6582d7f8 100644 --- a/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/impl/DatabasePostgresImpl.java +++ b/dbswitch-core/src/main/java/com/gitee/dbswitch/core/database/impl/DatabasePostgresImpl.java @@ -112,7 +112,11 @@ public class DatabasePostgresImpl extends AbstractDatabase implements IDatabaseI if (length < 1 || length >= AbstractDatabase.CLOB_LENGTH) { retval += "TEXT"; } else { - retval += "VARCHAR(" + length + ")"; + if (null != pks && pks.contains(fieldname)) { + retval += "VARCHAR(" + length + ")"; + } else { + retval += "TEXT"; + } } break; case ColumnMetaData.TYPE_BINARY: diff --git a/dbswitch-data/pom.xml b/dbswitch-data/pom.xml index 36dd9348..d15d4af5 100644 --- a/dbswitch-data/pom.xml +++ b/dbswitch-data/pom.xml @@ -5,7 +5,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 dbswitch-data diff --git a/dbswitch-dbchange/pom.xml b/dbswitch-dbchange/pom.xml index 2c4bc265..fba42892 100644 --- a/dbswitch-dbchange/pom.xml +++ b/dbswitch-dbchange/pom.xml @@ -5,7 +5,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 dbswitch-dbchange diff --git a/dbswitch-dbcommon/pom.xml b/dbswitch-dbcommon/pom.xml index 3936a1da..23759be9 100644 --- a/dbswitch-dbcommon/pom.xml +++ b/dbswitch-dbcommon/pom.xml @@ -3,7 +3,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 dbswitch-dbcommon diff --git a/dbswitch-dbsynch/pom.xml b/dbswitch-dbsynch/pom.xml index 66ecd114..a3b8f747 100644 --- a/dbswitch-dbsynch/pom.xml +++ b/dbswitch-dbsynch/pom.xml @@ -3,7 +3,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 dbswitch-dbsynch diff --git a/dbswitch-dbwriter/pom.xml b/dbswitch-dbwriter/pom.xml index 5b65d9ed..9beee526 100644 --- a/dbswitch-dbwriter/pom.xml +++ b/dbswitch-dbwriter/pom.xml @@ -5,7 +5,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 dbswitch-dbwriter diff --git a/dbswitch-pgwriter/pom.xml b/dbswitch-pgwriter/pom.xml index 00f99a31..093e225c 100644 --- a/dbswitch-pgwriter/pom.xml +++ b/dbswitch-pgwriter/pom.xml @@ -5,7 +5,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 dbswitch-pgwriter diff --git a/dbswitch-sql/pom.xml b/dbswitch-sql/pom.xml index 9103616c..625aa4ef 100644 --- a/dbswitch-sql/pom.xml +++ b/dbswitch-sql/pom.xml @@ -5,7 +5,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 dbswitch-sql diff --git a/dbswitch-webapi/pom.xml b/dbswitch-webapi/pom.xml index 77d2c66b..9138d34a 100644 --- a/dbswitch-webapi/pom.xml +++ b/dbswitch-webapi/pom.xml @@ -5,7 +5,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 dbswitch-webapi diff --git a/package-tool/pom.xml b/package-tool/pom.xml index 85cb8815..930b4f8d 100644 --- a/package-tool/pom.xml +++ b/package-tool/pom.xml @@ -5,7 +5,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 package-tool diff --git a/package-tool/src/main/assembly/bin/datasync.sh b/package-tool/src/main/assembly/bin/datasync.sh index 3d370ff0..46bb506e 100644 --- a/package-tool/src/main/assembly/bin/datasync.sh +++ b/package-tool/src/main/assembly/bin/datasync.sh @@ -21,7 +21,7 @@ APP_LIB_PATH=$APP_HOME/lib APP_CONF_PATH=$APP_HOME/conf # JVMFLAGS JVM参数可以在这里设置 -JVMFLAGS="-Xms1024m -Xmx1024m -Xmn512m -XX:+DisableExplicitGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Dfile.encoding=UTF-8 -Doracle.jdbc.J2EE13Compliant=true" +JVMFLAGS="-Xms2g -Xmx2g -Xmn1g -XX:+DisableExplicitGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Dfile.encoding=UTF-8 -Doracle.jdbc.J2EE13Compliant=true" if [ "$JAVA_HOME" != "" ]; then JAVA="$JAVA_HOME/bin/java" diff --git a/pom.xml b/pom.xml index d0ebc500..2d0a1e3e 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ com.gitee dbswitch - 1.5.1 + 1.5.2 pom dbswitch database switch project diff --git a/version.cmd b/version.cmd index a3325f93..3271f5ab 100644 --- a/version.cmd +++ b/version.cmd @@ -1,6 +1,6 @@ @echo off -set APP_VERSION=1.5.1 +set APP_VERSION=1.5.2 echo "Clean Project ..." call mvn clean -f pom.xml