feat: 添加中兴数据库GoldenDB的url识别jdbc-driver逻辑

This commit is contained in:
zchazc 2025-03-05 16:49:40 +08:00
parent 2046809264
commit c94e3baa28
No known key found for this signature in database
GPG Key ID: E7894CF9AF1D4CE0
3 changed files with 10 additions and 1 deletions

View File

@ -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;

View File

@ -116,4 +116,8 @@ public interface DriverNamePool {
* JDBC 驱动 OpenGauss
*/
String DRIVER_OPENGAUSS = "org.opengauss.Driver";
/**
* JDBC 驱动 GoldenDB
*/
String DRIVER_GOLDENDB = "com.goldendb.jdbc.Driver";
}

View File

@ -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,