use of org.sagacity.sqltoy.dialect.impl.TidbDialect in project sagacity-sqltoy by chenrenfei.
the class DialectFactory method getDialectSqlWrapper.
/**
* @todo 根据数据库类型获取处理sql的handler
* @param dbType
* @return
* @throws Exception
*/
private Dialect getDialectSqlWrapper(Integer dbType) throws Exception {
// 从map中直接获取实例,避免重复创建和判断
if (dialects.containsKey(dbType)) {
return dialects.get(dbType);
}
// 按照市场排名作为优先顺序
Dialect dialectSqlWrapper = null;
switch(dbType) {
// oracle12c(分页方式有了改变,支持identity主键策略(内部其实还是sequence模式))
case DBType.ORACLE:
{
dialectSqlWrapper = new OracleDialect();
break;
}
// MariaDB 在检测的时候归并到mysql,采用跟mysql一样的语法
case DBType.MYSQL:
case DBType.MYSQL57:
{
dialectSqlWrapper = new MySqlDialect();
break;
}
// sqlserver2012 以后分页方式更简单
case DBType.SQLSERVER:
{
dialectSqlWrapper = new SqlServerDialect();
break;
}
// postgresql/greenplum
case DBType.POSTGRESQL:
{
dialectSqlWrapper = new PostgreSqlDialect();
break;
}
// oceanbase 数据库支持
case DBType.OCEANBASE:
{
dialectSqlWrapper = new OceanBaseDialect();
break;
}
// db2 10.x版本分页支持offset模式
case DBType.DB2:
{
dialectSqlWrapper = new DB2Dialect();
break;
}
// clickhouse 19.x 版本开始支持
case DBType.CLICKHOUSE:
{
dialectSqlWrapper = new ClickHouseDialect();
break;
}
// Tidb方言支持
case DBType.TIDB:
{
dialectSqlWrapper = new TidbDialect();
break;
}
// 华为guassdb(postgresql 为蓝本的)
case DBType.GAUSSDB:
{
dialectSqlWrapper = new GuassDBDialect();
break;
}
case DBType.IMPALA:
{
dialectSqlWrapper = new ImpalaDialect();
break;
}
// dm数据库支持(以oracle为蓝本)
case DBType.DM:
{
dialectSqlWrapper = new DMDialect();
break;
}
// 基本支持(sqlite 本身功能就相对简单)
case DBType.SQLITE:
{
dialectSqlWrapper = new SqliteDialect();
break;
}
// 10g,11g
case DBType.ORACLE11:
{
dialectSqlWrapper = new Oracle11gDialect();
break;
}
// 北大金仓
case DBType.KINGBASE:
{
dialectSqlWrapper = new KingbaseDialect();
break;
}
// 如果匹配不上使用默认dialect
default:
dialectSqlWrapper = new DefaultDialect();
}
dialects.put(dbType, dialectSqlWrapper);
return dialectSqlWrapper;
}
Aggregations