1.修复mysql数据库使用前置sql语句时,因数据库名包含特殊字符导致的报错问题

2.修复oracle使用use语句导致的报错问题
This commit is contained in:
diantu
2023-01-16 14:52:35 +08:00
parent 602a9cc55c
commit b9a1a33c4e
2 changed files with 30 additions and 6 deletions

View File

@@ -34,6 +34,20 @@ public class MysqlServiceImpl extends DbBaseService {
return DatabaseProductEnum.MYSQL;
}
/**
* mysql数据库名中含有 - 等特殊字符,需要用反引号包裹
*
* @author diantu
* @since 2023年1月16日
*/
@Override
public String getUseDbSql(String dbName) {
if (StringUtils.isNotBlank(dbName)) {
return "use " + "`" + dbName + "`";
}
return null;
}
@Override
public TableDdlVo getTableDdl(Long sourceId, String dbName, String tableName) {
BaseMapper baseMapper = this.getViewAuthBaseMapper(sourceId);

View File

@@ -16,4 +16,14 @@ public class OracleServiceImpl extends DbBaseService {
public DatabaseProductEnum getDatabaseProduct() {
return DatabaseProductEnum.ORACLE;
}
/**
* oracle数据库中没有也不需要use语句,指定数据库名的情况下直接返回空即可
* @author diantu
* @since 2023年1月16日
*/
@Override
public String getUseDbSql(String dbName) {
return null;
}
}