From 197a2646975d96e809b3401ea628cb65dd267c57 Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:06:29 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E5=8A=A0=E5=85=A5gbase=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=AE=9A=E4=B9=89=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/database/GBase8cDatabase.java | 27 +++++++++++++++++++ .../common/database/GBase8sDatabase.java | 27 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/database/GBase8cDatabase.java create mode 100644 caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/database/GBase8sDatabase.java diff --git a/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/database/GBase8cDatabase.java b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/database/GBase8cDatabase.java new file mode 100644 index 0000000..98da97b --- /dev/null +++ b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/database/GBase8cDatabase.java @@ -0,0 +1,27 @@ +package io.iec.edp.caf.databaseobject.common.database; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class GBase8cDatabase extends AbstractDatabaseImpl { + + public GBase8cDatabase(DbConfigData configData) { + super(configData); + } + + @Override + public Connection getConnection(DbConfigData configData) throws SQLException { + Connection c = null; + String url = configData.getConnectionString(); + + try { + Class.forName("cn.gbase8c.Driver"); + c = DriverManager.getConnection(url, configData.getUserId(), configData.getPassword()); + } catch (ClassNotFoundException e) { + throw new RuntimeException("构造GBASE8C数据库连接出错,找不到Driver:" + e); + } + + return c; + } +} \ No newline at end of file diff --git a/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/database/GBase8sDatabase.java b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/database/GBase8sDatabase.java new file mode 100644 index 0000000..f226369 --- /dev/null +++ b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/database/GBase8sDatabase.java @@ -0,0 +1,27 @@ +package io.iec.edp.caf.databaseobject.common.database; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class GBase8sDatabase extends AbstractDatabaseImpl { + + public GBase8sDatabase(DbConfigData configData) { + super(configData); + } + + @Override + public Connection getConnection(DbConfigData configData) throws SQLException { + Connection c = null; + String url = configData.getConnectionString(); + + try { + Class.forName("cn.gbase8s.Driver"); + c = DriverManager.getConnection(url, configData.getUserId(), configData.getPassword()); + } catch (ClassNotFoundException e) { + throw new RuntimeException("构造GBASE8S数据库连接出错,找不到Driver:" + e); + } + + return c; + } +} \ No newline at end of file -- Gitee From 3185f58748b1109eb7ec7ed5829bcb32fca0feb4 Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:08:39 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=88=A4=E6=96=ADgbase?= =?UTF-8?q?=20jdbc=E8=BF=9E=E6=8E=A5=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../caf/databaseobject/common/DatabaseObjectCommonUtil.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java index 59cb2ee..541f51d 100644 --- a/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java +++ b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java @@ -658,6 +658,10 @@ public class DatabaseObjectCommonUtil { dbInfo.setDbType(DbType.DB2); } else if (t.equals("opengauss")) { dbInfo.setDbType(DbType.OpenGauss); + } else if (t.equals("gbase8s")) { + dbInfo.setDbType(DbType.GBase8s); + } else if (t.equals("gbase8c")) { + dbInfo.setDbType(DbType.GBase8c); } return dbInfo; -- Gitee From a1cfe633c317b379f26643eb2ebdb6198cfc9731 Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:10:53 +0800 Subject: [PATCH 03/15] =?UTF-8?q?common=20=E5=8A=A0=E5=85=A5=E5=88=A4?= =?UTF-8?q?=E6=96=ADgbase=20=E6=9F=A5=E8=AF=A2=E6=89=80=E6=9C=89=E8=A1=A8?= =?UTF-8?q?=E7=9A=84sql=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../caf/databaseobject/common/DatabaseObjectCommonUtil.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java index 541f51d..84d3cf3 100644 --- a/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java +++ b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java @@ -691,7 +691,8 @@ public class DatabaseObjectCommonUtil { String sql = null; if (db.getDbType() == DbType.Oracle || db.getDbType() == DbType.DM || db.getDbType() == DbType.Oscar) { sql = "select table_name from user_tables"; - } else if (db.getDbType() == DbType.PgSQL || db.getDbType() == DbType.HighGo || db.getDbType() == DbType.OpenGauss) { + } else if (db.getDbType() == DbType.PgSQL || db.getDbType() == DbType.HighGo || db.getDbType() == DbType.OpenGauss + || db.getDbType() == DbType.GBase8s || db.getDbType() == DbType.GBase8c) { sql = "select tablename from pg_tables where lower(schemaname)='" + db.getUserName().toLowerCase() + "'"; } else if (db.getDbType() == DbType.MySQL) { sql = "select TABLE_NAME from information_schema.TABLES where TABLE_TYPE='BASE TABLE' and LOWER(TABLE_SCHEMA)='" + db.getDbName().toLowerCase() + "'"; -- Gitee From c89b33a1cbe6a27f96951099601972a155be04e0 Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:12:37 +0800 Subject: [PATCH 04/15] =?UTF-8?q?common=20=E5=8A=A0=E5=85=A5=E5=88=A4?= =?UTF-8?q?=E6=96=ADgbase=20=E6=9F=A5=E8=AF=A2=E7=89=A9=E7=90=86=E8=A1=A8?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8=E7=9A=84sql=E8=AF=AD?= =?UTF-8?q?=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../caf/databaseobject/common/DatabaseObjectCommonUtil.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java index 84d3cf3..8024962 100644 --- a/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java +++ b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java @@ -815,7 +815,8 @@ public class DatabaseObjectCommonUtil { String sql = ""; if (db.getDbType() == DbType.Oracle || db.getDbType() == DbType.DM || db.getDbType() == DbType.Oscar) { sql = "select OBJECT_NAME from ALL_OBJECTS where temporary = 'Y' and OBJECT_NAME = '"+tableName.toUpperCase()+"'"; - } else if (db.getDbType() == DbType.PgSQL || db.getDbType() == DbType.HighGo || db.getDbType() == DbType.OpenGauss) { + } else if (db.getDbType() == DbType.PgSQL || db.getDbType() == DbType.HighGo || db.getDbType() == DbType.OpenGauss + || db.getDbType() == DbType.GBase8s || db.getDbType() == DbType.GBase8c) { sql = "select tablename from (select to_regclass('"+tableName.toLowerCase()+"') as tablename) t where tablename is not null"; } else if (db.getDbType() == DbType.MySQL) { return ""; -- Gitee From 29a1131bef1957de057bd1967990cf1253d02a23 Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:14:13 +0800 Subject: [PATCH 05/15] =?UTF-8?q?common=20=E5=8A=A0=E5=85=A5=E5=88=A4?= =?UTF-8?q?=E6=96=ADgbase=20=E6=9F=A5=E8=AF=A2=E8=A1=A8=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8=E7=9A=84sql=E8=AF=AD?= =?UTF-8?q?=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../caf/databaseobject/common/DatabaseObjectCommonUtil.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java index 8024962..a8003f7 100644 --- a/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java +++ b/caf-database-object-common/src/main/java/io/iec/edp/caf/databaseobject/common/DatabaseObjectCommonUtil.java @@ -844,7 +844,8 @@ public class DatabaseObjectCommonUtil { String sql = null; if (db.getDbType() == DbType.Oracle || db.getDbType() == DbType.DM || db.getDbType() == DbType.Oscar) { sql = "SELECT COUNT(1) FROM USER_TAB_COLS WHERE COLUMN_NAME = '" + filed.toUpperCase() + "' AND TABLE_NAME ='" + table.toUpperCase() + "'"; - } else if (db.getDbType() == DbType.PgSQL || db.getDbType() == DbType.HighGo || db.getDbType() == DbType.OpenGauss) { + } else if (db.getDbType() == DbType.PgSQL || db.getDbType() == DbType.HighGo || db.getDbType() == DbType.OpenGauss + || db.getDbType() == DbType.GBase8s || db.getDbType() == DbType.GBase8c) { sql = "SELECT COUNT(1) FROM INFORMATION_SCHEMA.COLUMNS WHERE LOWER(TABLE_NAME) = '" + table.toLowerCase() + "' AND LOWER(COLUMN_NAME) = '" + filed.toLowerCase() + "' AND LOWER(TABLE_SCHEMA) = '" + db.getUserName().toLowerCase() + "'"; } else if (db.getDbType() == DbType.MySQL) { sql = "SELECT COUNT(1) FROM information_schema.columns WHERE table_name='" + table.toLowerCase() + "' AND column_name='" + filed.toLowerCase() + "' AND TABLE_SCHEMA = '" + db.getDbName().toLowerCase() + "'"; -- Gitee From cdb1d15ca220fd17d1a0f8c2d6827ec11220c3e2 Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:15:52 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E6=96=B9=E6=B3=95getDbInfo()=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0gbase=E6=95=B0=E6=8D=AE=E5=BA=93=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java b/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java index 493af7a..3c6c581 100644 --- a/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java +++ b/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java @@ -198,7 +198,7 @@ public class DboDeploy implements CommandLineRunner { private static void getDbInfo() { Scanner scanner = new Scanner(System.in); getDBOPath(scanner); - System.out.println("请选择数据库类型:1.PgSql 2.SqlServer 3.Oracle 4.DM 5.Highgo 6.MySQL 7.Oscar 8.Kingbase 9.DB2 10.OpenGauss[1]"); + System.out.println("请选择数据库类型:1.PgSql 2.SqlServer 3.Oracle 4.DM 5.Highgo 6.MySQL 7.Oscar 8.Kingbase 9.DB2 10.OpenGauss 11.GBase8s 12.GBase8c[1]"); String type = scanner.nextLine(); checkDbType(type, scanner); -- Gitee From 587eb43ffeae4a08670adcf2dbd16df69f6beb04 Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:17:04 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E6=96=B9=E6=B3=95getDefaultPort=EF=BC=88?= =?UTF-8?q?=EF=BC=89=E6=B7=BB=E5=8A=A0gbase=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=BB=98=E8=AE=A4=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/iec/edp/caf/databaseobject/DboDeploy.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java b/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java index 3c6c581..90ab4bf 100644 --- a/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java +++ b/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java @@ -285,6 +285,12 @@ public class DboDeploy implements CommandLineRunner { case OpenGauss: defaultPort = "5432"; break; + case GBase8s: + defaultPort = "15432"; + break; + case GBase8c: + defaultPort = "15432"; + break; default: defaultPort = "5432"; break; -- Gitee From 2c53a3d31db0aaabdc7525a83678db04c5b991ad Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:18:07 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E6=96=B9=E6=B3=95getDefaultUser()?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0gbase=E6=95=B0=E6=8D=AE=E5=BA=93=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=BB=98=E8=AE=A4=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/iec/edp/caf/databaseobject/DboDeploy.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java b/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java index 90ab4bf..c1f7847 100644 --- a/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java +++ b/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java @@ -331,6 +331,11 @@ public class DboDeploy implements CommandLineRunner { case OpenGauss: defaultUserName = "omm"; break; + case GBase8s: + defaultUserName = "gbase"; + break; + case GBase8c: + defaultUserName = "gbase"; default: defaultUserName = "postgres"; break; -- Gitee From ee3539cad490184811ede16b9c2721445c6f6a56 Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:19:54 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E6=96=B9=E6=B3=95checkDbType()=E6=A3=80?= =?UTF-8?q?=E6=9F=A5gbase=E6=95=B0=E6=8D=AE=E5=BA=93=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/iec/edp/caf/databaseobject/DboDeploy.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java b/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java index c1f7847..6776936 100644 --- a/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java +++ b/caf-database-object-deploy/src/main/java/io/iec/edp/caf/databaseobject/DboDeploy.java @@ -405,8 +405,14 @@ public class DboDeploy implements CommandLineRunner { } else if ("10".equals(type) || "OpenGauss".equals(type)) { dbType = DbType.OpenGauss; - }else { - System.out.println("请选择数据库类型:1.PgSql 2.SqlServer 3.Oracle 4.DM 5.Highgo 6.MySQL 7.Oscar 8.Kingbase 9.DB2 10.OpenGauss[1]"); + }else if ("11".equals(type) || "GBase8s".equals(type)) { + dbType = DbType.GBase8s; + + } else if ("12".equals(type) || "GBase8c".equals(type)) { + dbType = DbType.GBase8c; + + } else { + System.out.println("请选择数据库类型:1.PgSql 2.SqlServer 3.Oracle 4.DM 5.Highgo 6.MySQL 7.Oscar 8.Kingbase 9.DB2 10.OpenGauss 11.GBase8s 12.GBase8c[1]"); type = scanner.nextLine(); checkDbType(type, scanner); } -- Gitee From f1190cded4712c8cc5f49316b9deb63a7b42ea27 Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:27:26 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=E6=96=B9=E6=B3=95applySetting()=E8=AE=BE?= =?UTF-8?q?=E7=BD=AEhibernate=E7=9A=84gbase=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=E5=8C=85=E6=8B=AC=E6=96=B9?= =?UTF-8?q?=E8=A8=80=E3=80=81=E9=A9=B1=E5=8A=A8=E4=BF=A1=E6=81=AF=E3=80=81?= =?UTF-8?q?schema=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/export/DatabaseObjectExportManager.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java b/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java index d8e9924..46507bf 100644 --- a/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java +++ b/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java @@ -120,6 +120,14 @@ public class DatabaseObjectExportManager { serviceRegistryBuilder.applySetting("hibernate.default_schema", "[" + dbInfo.getUserName() + "]"); serviceRegistryBuilder.applySetting("hibernate.connection.driver_class", "org.opengauss.Driver"); serviceRegistryBuilder.applySetting("hibernate.dialect", "org.hibernate.dialect.PostgreSQL95Dialect"); + } else if (dbType == DbType.GBase8s) { + serviceRegistryBuilder.applySetting("hibernate.default_schema", "[" + dbInfo.getUserName() + "]"); + serviceRegistryBuilder.applySetting("hibernate.connection.driver_class", "cn.gbase8s.Driver"); + serviceRegistryBuilder.applySetting("hibernate.dialect", "org.hibernate.dialect.PostgreSQL95Dialect"); + } else if (dbType == DbType.GBase8c) { + serviceRegistryBuilder.applySetting("hibernate.default_schema", "[" + dbInfo.getUserName() + "]"); + serviceRegistryBuilder.applySetting("hibernate.connection.driver_class", "cn.gbase8c.Driver"); + serviceRegistryBuilder.applySetting("hibernate.dialect", "org.hibernate.dialect.PostgreSQL95Dialect"); } } -- Gitee From b93d6045097151a2ddfeba1b332745b0b2d578c1 Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:29:10 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=E6=96=B9=E6=B3=95lowerOrUpperCase()?= =?UTF-8?q?=EF=BC=8C=E8=AE=BE=E7=BD=AEgbase=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iec/edp/caf/databaseobject/DboPhysicalNamingStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caf-database-object-deploy-manager/src/main/java/io/iec/edp/caf/databaseobject/DboPhysicalNamingStrategy.java b/caf-database-object-deploy-manager/src/main/java/io/iec/edp/caf/databaseobject/DboPhysicalNamingStrategy.java index 5040497..3ed7b6b 100644 --- a/caf-database-object-deploy-manager/src/main/java/io/iec/edp/caf/databaseobject/DboPhysicalNamingStrategy.java +++ b/caf-database-object-deploy-manager/src/main/java/io/iec/edp/caf/databaseobject/DboPhysicalNamingStrategy.java @@ -125,7 +125,7 @@ public class DboPhysicalNamingStrategy implements PhysicalNamingStrategy { if(DbType.OpenGauss.equals(dbType)){ return LetterCase.lowerCase; } - if (name.contains("postgresql") || name.contains("hgdbdialect") || name.contains("mysql")) { + if (name.contains("postgresql") || name.contains("hgdbdialect") || name.contains("mysql") || name.contains("gbase")) { return LetterCase.lowerCase; } else if (name.contains("oracle") || name.contains("dm") || name.contains("oscar") || name.contains("db2")) { return LetterCase.upperCase; -- Gitee From c9af50f648782eaf795a3339a75b95cd660738af Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:41:24 +0800 Subject: [PATCH 12/15] =?UTF-8?q?=E6=96=B9=E6=B3=95applySetting()=E8=AE=BE?= =?UTF-8?q?=E7=BD=AEhibernate=E7=9A=84gbase=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=E5=8C=85=E6=8B=AC=E6=96=B9?= =?UTF-8?q?=E8=A8=80=E3=80=81=E9=A9=B1=E5=8A=A8=E4=BF=A1=E6=81=AF=E3=80=81?= =?UTF-8?q?schema=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/iec/edp/caf/databaseobject/DboDeployManager.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/caf-database-object-deploy-manager/src/main/java/io/iec/edp/caf/databaseobject/DboDeployManager.java b/caf-database-object-deploy-manager/src/main/java/io/iec/edp/caf/databaseobject/DboDeployManager.java index b865b5d..43c8c9d 100644 --- a/caf-database-object-deploy-manager/src/main/java/io/iec/edp/caf/databaseobject/DboDeployManager.java +++ b/caf-database-object-deploy-manager/src/main/java/io/iec/edp/caf/databaseobject/DboDeployManager.java @@ -723,6 +723,14 @@ public class DboDeployManager { serviceRegistryBuilder.applySetting("hibernate.default_schema", "[" + dbInfo.getUserName() + "]"); serviceRegistryBuilder.applySetting("hibernate.connection.driver_class", "org.opengauss.Driver"); serviceRegistryBuilder.applySetting("hibernate.dialect", "org.hibernate.dialect.PostgreSQL95Dialect"); + } else if (dbType == DbType.GBase8s) { + serviceRegistryBuilder.applySetting("hibernate.default_schema", "[" + dbInfo.getUserName() + "]"); + serviceRegistryBuilder.applySetting("hibernate.connection.driver_class", "cn.gbase8s.Driver"); + serviceRegistryBuilder.applySetting("hibernate.dialect", "org.hibernate.dialect.PostgreSQL95Dialect"); + } else if (dbType == DbType.GBase8c) { + serviceRegistryBuilder.applySetting("hibernate.default_schema", "[" + dbInfo.getUserName() + "]"); + serviceRegistryBuilder.applySetting("hibernate.connection.driver_class", "cn.gbase8c.Driver"); + serviceRegistryBuilder.applySetting("hibernate.dialect", "org.hibernate.dialect.PostgreSQL95Dialect"); } } -- Gitee From 328ca69c25548002a84c32d80a0eccbaeceb4bdd Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:43:29 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E6=96=B9=E6=B3=95getDatabaseObjectsByTab?= =?UTF-8?q?lesName()=EF=BC=8C=E6=A0=B9=E6=8D=AE=E7=89=A9=E7=90=86=E8=A1=A8?= =?UTF-8?q?=E5=90=8D=E5=8F=8D=E5=90=91=E5=87=BA=E5=85=B7dbo=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E3=80=82=E6=A0=B9=E6=8D=AEgbase=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=A1=A8=E5=90=8D=E6=98=AF=E5=A4=A7=E5=86=99=E8=BF=98?= =?UTF-8?q?=E6=98=AF=E5=B0=8F=E5=86=99=E8=BF=9B=E8=A1=8C=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/export/DatabaseObjectExportManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java b/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java index 46507bf..32d0a1c 100644 --- a/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java +++ b/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java @@ -185,7 +185,8 @@ public class DatabaseObjectExportManager { if (dbType == DbType.Oracle || dbType == DbType.DM || dbType == DbType.Oscar || dbType == DbType.DB2) { table = table.toUpperCase(); } - if (dbType == DbType.PgSQL || dbType == DbType.HighGo || dbType == DbType.MySQL || dbType==DbType.OpenGauss) { + if (dbType == DbType.PgSQL || dbType == DbType.HighGo || dbType == DbType.MySQL || dbType==DbType.OpenGauss + || dbType == DbType.GBase8s || dbType == DbType.GBase8c) { table = table.toLowerCase(); } String currentDboName = StringUtils.isNotBlank(dboName) ? dboName : table; -- Gitee From 095b0a40509c637224e8b9c6e262bb4c1cd1945f Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 19:44:41 +0800 Subject: [PATCH 14/15] =?UTF-8?q?=E6=96=B9=E6=B3=95getColumnDataType(Colum?= =?UTF-8?q?nInformation=20columnInfo)=20=E6=B7=BB=E5=8A=A0=E6=A0=B9?= =?UTF-8?q?=E6=8D=AEgbase=E6=95=B0=E6=8D=AE=E5=BA=93=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=9B=B8=E5=BA=94=E5=AD=97=E6=AE=B5=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E5=88=A4=E6=96=AD=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/export/DatabaseObjectExportManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java b/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java index 32d0a1c..fbab28c 100644 --- a/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java +++ b/caf-database-object-manager/src/main/java/io/iec/edp/caf/databaseobject/manager/export/DatabaseObjectExportManager.java @@ -312,7 +312,8 @@ public class DatabaseObjectExportManager { * @return DBO中支持的字段类型 */ private DataType getColumnDataType(ColumnInformation columnInfo) { - if (dbType == DbType.PgSQL || dbType == DbType.HighGo || dbType == DbType.OpenGauss) { + if (dbType == DbType.PgSQL || dbType == DbType.HighGo || dbType == DbType.OpenGauss + || dbType == DbType.GBase8s || dbType == DbType.GBase8c) { return getPgColumnDataType(columnInfo); } else if (dbType == DbType.SQLServer) { return getSqlServerColumnDataType(columnInfo); -- Gitee From 60ea728c443fb48e8e111f8f63968e96b296eb13 Mon Sep 17 00:00:00 2001 From: gailibing Date: Fri, 14 Jul 2023 20:03:31 +0800 Subject: [PATCH 15/15] =?UTF-8?q?=E5=8A=A0=E5=85=A5caf-database-object-dep?= =?UTF-8?q?loy-gbase8sgenerator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pom.xml | 27 +++++++++++++ .../gbase8sgenerator/GBase8sGenerator.java | 40 +++++++++++++++++++ pom.xml | 14 ++++--- 3 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 caf-database-object-deploy-gbase8sgenerator/pom.xml create mode 100644 caf-database-object-deploy-gbase8sgenerator/src/main/java/io/iec/edp/caf/databaseobject/gbase8sgenerator/GBase8sGenerator.java diff --git a/caf-database-object-deploy-gbase8sgenerator/pom.xml b/caf-database-object-deploy-gbase8sgenerator/pom.xml new file mode 100644 index 0000000..9fb33d1 --- /dev/null +++ b/caf-database-object-deploy-gbase8sgenerator/pom.xml @@ -0,0 +1,27 @@ + + + + caf-database-object + io.iec.edp + 0.3.1 + + 4.0.0 + + caf-database-object-deploy-gbase8sgenerator + + + io.iec.edp + caf-database-object-deploy-defaultsqlgenerator + 0.3.1 + compile + + + + + 8 + 8 + + + \ No newline at end of file diff --git a/caf-database-object-deploy-gbase8sgenerator/src/main/java/io/iec/edp/caf/databaseobject/gbase8sgenerator/GBase8sGenerator.java b/caf-database-object-deploy-gbase8sgenerator/src/main/java/io/iec/edp/caf/databaseobject/gbase8sgenerator/GBase8sGenerator.java new file mode 100644 index 0000000..d434f31 --- /dev/null +++ b/caf-database-object-deploy-gbase8sgenerator/src/main/java/io/iec/edp/caf/databaseobject/gbase8sgenerator/GBase8sGenerator.java @@ -0,0 +1,40 @@ +/* + * Copyright © OpenAtom Foundation. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package io.iec.edp.caf.databaseobject.gbase8sgenerator; + +import io.iec.edp.caf.databaseobject.defaultsqlgenerator.AbstractDefaultSqlGenerator; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author liu_wei + */ +public class GBase8sGenerator extends AbstractDefaultSqlGenerator { + @Override + public List GetViewSql(String viewName, String defination) { + List result = new ArrayList(); + String dropSql = "drop view if exists " + viewName; + result.add(dropSql); + String sql = "Create View " + viewName + " AS " + defination; + result.add(sql); + return result; + } + + @Override + public String getDefaultValue(String schemaName, String tableName, String colName) { + return "SELECT column_default AS defaultvalue FROM information_schema.columns WHERE table_schema= '" + schemaName + "' and table_name = '" + tableName + "' and column_name = '" + colName + "'"; + } +} diff --git a/pom.xml b/pom.xml index 4339e2e..b6e6cef 100644 --- a/pom.xml +++ b/pom.xml @@ -37,17 +37,19 @@ caf-database-object-deploy-db2generator caf-database-object-deploy-gaussgenerator caf-database-object-rpcapi + caf-database-object-deploy-gbase8sgenerator - - io.iec.edp - caf-boot-parent - 0.3.7 - + + + + + + io.iec.edp caf-database-object pom - 0.3.0 + 0.3.1 -- Gitee