mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
IssueI6EUXQ 修复通过JDBC URL等信息识别JDBC驱动 时重复,以及部分注释错误
This commit is contained in:
parent
9dbdf1423e
commit
582a6eb658
@ -153,18 +153,16 @@ public class DialectFactory implements DriverNamePool {
|
|||||||
// 华为高斯
|
// 华为高斯
|
||||||
driver = DRIVER_GAUSS;
|
driver = DRIVER_GAUSS;
|
||||||
} else if (nameContainsProductInfo.contains("gbase")) {
|
} else if (nameContainsProductInfo.contains("gbase")) {
|
||||||
// 华为高斯
|
// 南大通用数据库
|
||||||
driver = DRIVER_GBASE;
|
driver = DRIVER_GBASE;
|
||||||
} else if (nameContainsProductInfo.contains("oscar")) {
|
} else if (nameContainsProductInfo.contains("oscar")) {
|
||||||
// 神州数据库
|
// 神州数据库
|
||||||
driver = DRIVER_OSCAR;
|
driver = DRIVER_OSCAR;
|
||||||
} else if (nameContainsProductInfo.contains("sybase")) {
|
} else if (nameContainsProductInfo.contains("sybase")) {
|
||||||
// 神州数据库
|
// Sybase
|
||||||
driver = DRIVER_SYBASE;
|
driver = DRIVER_SYBASE;
|
||||||
} else if (nameContainsProductInfo.contains("xugu")) {
|
|
||||||
// 虚谷数据库
|
|
||||||
driver = DRIVER_XUGO;
|
|
||||||
}else if (nameContainsProductInfo.contains("mariadb")) {
|
}else if (nameContainsProductInfo.contains("mariadb")) {
|
||||||
|
// mariadb
|
||||||
driver = DRIVER_MARIADB;
|
driver = DRIVER_MARIADB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
package cn.hutool.db.dialect;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.hutool.db.dialect.DriverNamePool.*;
|
||||||
|
|
||||||
|
public class DialectFactoryTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void identifyDriverTest(){
|
||||||
|
|
||||||
|
Map<String,String> map = new HashMap<>(25);
|
||||||
|
map.put("mysql",DRIVER_MYSQL_V6);
|
||||||
|
map.put("cobar",DRIVER_MYSQL_V6);
|
||||||
|
map.put("oracle",DRIVER_ORACLE);
|
||||||
|
map.put("postgresql",DRIVER_POSTGRESQL);
|
||||||
|
map.put("sqlite",DRIVER_SQLLITE3);
|
||||||
|
map.put("sqlserver",DRIVER_SQLSERVER);
|
||||||
|
map.put("microsoft",DRIVER_SQLSERVER);
|
||||||
|
map.put("hive2",DRIVER_HIVE2);
|
||||||
|
map.put("hive",DRIVER_HIVE);
|
||||||
|
map.put("h2",DRIVER_H2);
|
||||||
|
map.put("derby",DRIVER_DERBY);
|
||||||
|
map.put("hsqldb",DRIVER_HSQLDB);
|
||||||
|
map.put("dm",DRIVER_DM7);
|
||||||
|
map.put("kingbase8",DRIVER_KINGBASE8);
|
||||||
|
map.put("ignite",DRIVER_IGNITE_THIN);
|
||||||
|
map.put("clickhouse",DRIVER_CLICK_HOUSE);
|
||||||
|
map.put("highgo",DRIVER_HIGHGO);
|
||||||
|
map.put("db2",DRIVER_DB2);
|
||||||
|
map.put("xugu",DRIVER_XUGU);
|
||||||
|
map.put("phoenix",DRIVER_PHOENIX);
|
||||||
|
map.put("zenith",DRIVER_GAUSS);
|
||||||
|
map.put("gbase",DRIVER_GBASE);
|
||||||
|
map.put("oscar",DRIVER_OSCAR);
|
||||||
|
map.put("sybase",DRIVER_SYBASE);
|
||||||
|
map.put("mariadb",DRIVER_MARIADB);
|
||||||
|
|
||||||
|
|
||||||
|
map.forEach((k,v) -> Assert.assertEquals(v,
|
||||||
|
DialectFactory.identifyDriver(k+ RandomUtil.randomString(2),null) ));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user