From c94e3baa28f1987517e31a86c3320251f961ea59 Mon Sep 17 00:00:00 2001 From: zchazc Date: Wed, 5 Mar 2025 16:49:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=B8=AD=E5=85=B4?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93GoldenDB=E7=9A=84url=E8=AF=86?= =?UTF-8?q?=E5=88=ABjdbc-driver=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/hutool/db/dialect/DialectFactory.java | 6 +++++- .../src/main/java/cn/hutool/db/dialect/DriverNamePool.java | 4 ++++ .../test/java/cn/hutool/db/dialect/DialectFactoryTest.java | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hutool-db/src/main/java/cn/hutool/db/dialect/DialectFactory.java b/hutool-db/src/main/java/cn/hutool/db/dialect/DialectFactory.java index 1368a08f3..7fcc12763 100755 --- a/hutool-db/src/main/java/cn/hutool/db/dialect/DialectFactory.java +++ b/hutool-db/src/main/java/cn/hutool/db/dialect/DialectFactory.java @@ -45,7 +45,8 @@ public class DialectFactory implements DriverNamePool { */ private static Dialect internalNewDialect(String driverName) { if (StrUtil.isNotBlank(driverName)) { - if (DRIVER_MYSQL.equalsIgnoreCase(driverName) || DRIVER_MYSQL_V6.equalsIgnoreCase(driverName)) { + if (DRIVER_MYSQL.equalsIgnoreCase(driverName) || DRIVER_MYSQL_V6.equalsIgnoreCase(driverName) + || DRIVER_GOLDENDB.equalsIgnoreCase(driverName)) { return new MysqlDialect(); } else if (DRIVER_ORACLE.equalsIgnoreCase(driverName) || DRIVER_ORACLE_OLD.equalsIgnoreCase(driverName)) { return new OracleDialect(); @@ -164,6 +165,9 @@ public class DialectFactory implements DriverNamePool { } else if (nameContainsProductInfo.contains("opengauss")) { // OpenGauss driver = DRIVER_OPENGAUSS; + } else if (nameContainsProductInfo.contains("goldendb")) { + // GoldenDB + driver = DRIVER_GOLDENDB; } return driver; diff --git a/hutool-db/src/main/java/cn/hutool/db/dialect/DriverNamePool.java b/hutool-db/src/main/java/cn/hutool/db/dialect/DriverNamePool.java index a5c81ba40..998bc0a0b 100644 --- a/hutool-db/src/main/java/cn/hutool/db/dialect/DriverNamePool.java +++ b/hutool-db/src/main/java/cn/hutool/db/dialect/DriverNamePool.java @@ -116,4 +116,8 @@ public interface DriverNamePool { * JDBC 驱动 OpenGauss */ String DRIVER_OPENGAUSS = "org.opengauss.Driver"; + /** + * JDBC 驱动 GoldenDB + */ + String DRIVER_GOLDENDB = "com.goldendb.jdbc.Driver"; } diff --git a/hutool-db/src/test/java/cn/hutool/db/dialect/DialectFactoryTest.java b/hutool-db/src/test/java/cn/hutool/db/dialect/DialectFactoryTest.java index b262006db..ee35228d8 100644 --- a/hutool-db/src/test/java/cn/hutool/db/dialect/DialectFactoryTest.java +++ b/hutool-db/src/test/java/cn/hutool/db/dialect/DialectFactoryTest.java @@ -42,6 +42,7 @@ public class DialectFactoryTest { map.put("oscar",DRIVER_OSCAR); map.put("sybase",DRIVER_SYBASE); map.put("mariadb",DRIVER_MARIADB); + map.put("goldendb",DRIVER_GOLDENDB); map.forEach((k,v) -> assertEquals(v,