Merge pull request #3763 from liaosnet/3.0

增加对南大通用GBase 8s数据库的支持
This commit is contained in:
qmdx 2021-08-07 17:28:31 +08:00 committed by GitHub
commit 22c471608e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 1 deletions

View File

@ -99,7 +99,8 @@ public enum DbType {
/**
* GBase
*/
GBASE("gbase", "南大通用数据库"),
GBASE("gbase", "南大通用(华库)数据库"),
GBASEDBT("gbasedbt", "南大通用数据库"),
/**
* Oscar
*/

View File

@ -74,6 +74,8 @@ public class DialectFactory {
dialect = new SQLServerDialect();
} else if (dbType == DbType.SYBASE) {
dialect = new SybaseDialect();
} else if (dbType == DbType.GBASEDBT){
dialect = new GBasedbtDialect();
}
DIALECT_ENUM_MAP.put(dbType, dialect);
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2011-2021, baomidou (jobob@qq.com).
*
* 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 com.baomidou.mybatisplus.extension.plugins.pagination.dialects;
import com.baomidou.mybatisplus.extension.plugins.pagination.DialectModel;
/**
* GBase 8s V8.8 数据库分页语句组装实现
* 通用分页版本
*
* @author liaojinqing
* @since 2021-07-20
*/
public class GBasedbtDialect implements IDialect {
@Override
public DialectModel buildPaginationSql(String originalSql, long offset, long limit) {
StringBuilder sql = new StringBuilder(originalSql)
.insert(6, " SKIP " + FIRST_MARK + " FIRST " + SECOND_MARK);
return new DialectModel(sql.toString(), offset, limit).setConsumerChain();
}
}

View File

@ -93,6 +93,8 @@ public class JdbcUtils {
return DbType.GAUSS;
} else if (jdbcUrl.contains(":gbase:")) {
return DbType.GBASE;
} else if (jdbcUrl.contains(":gbasedbt-sqli:")) {
return DbType.GBASEDBT;
} else if (jdbcUrl.contains(":clickhouse:")) {
return DbType.CLICK_HOUSE;
} else if (jdbcUrl.contains(":oscar:")) {