【fix sonar】SqlUtils文件
This commit is contained in:
+10
-6
@@ -12,6 +12,10 @@ import java.util.Map;
|
||||
*/
|
||||
public class SqlUtils {
|
||||
|
||||
private SqlUtils(){
|
||||
|
||||
}
|
||||
|
||||
public static final String DATABSE_TYPE_MYSQL = "mysql";
|
||||
public static final String DATABSE_TYPE_POSTGRE = "postgresql";
|
||||
public static final String DATABSE_TYPE_ORACLE = "oracle";
|
||||
@@ -30,9 +34,9 @@ public class SqlUtils {
|
||||
* 获取所有表的SQL
|
||||
*/
|
||||
public static final String MYSQL_ALLTABLES_SQL = "select distinct table_name from information_schema.columns where table_schema = {0}";
|
||||
public static final String POSTGRE__ALLTABLES_SQL = "SELECT distinct c.relname AS table_name FROM pg_class c";
|
||||
public static final String ORACLE__ALLTABLES_SQL = "select distinct colstable.table_name as table_name from user_tab_cols colstable";
|
||||
public static final String SQLSERVER__ALLTABLES_SQL = "select distinct c.name as table_name from sys.objects c";
|
||||
public static final String POST_GRE_ALL_TABLES_SQL = "SELECT distinct c.relname AS table_name FROM pg_class c";
|
||||
public static final String ORACLE_ALL_TABLES_SQL = "select distinct colstable.table_name as table_name from user_tab_cols colstable";
|
||||
public static final String SQL_SERVER_ALL_TABLES_SQL = "select distinct c.name as table_name from sys.objects c";
|
||||
|
||||
/**
|
||||
* 获取指定表的所有列名
|
||||
@@ -184,11 +188,11 @@ public class SqlUtils {
|
||||
if (dbTypeIsMySQL(dbType)) {
|
||||
return MessageFormat.format(MYSQL_ALLTABLES_SQL, params);
|
||||
} else if (dbTypeIsOracle(dbType)) {
|
||||
return ORACLE__ALLTABLES_SQL;
|
||||
return ORACLE_ALL_TABLES_SQL;
|
||||
} else if (dbTypeIsPostgre(dbType)) {
|
||||
return POSTGRE__ALLTABLES_SQL;
|
||||
return POST_GRE_ALL_TABLES_SQL;
|
||||
} else if (dbTypeIsSQLServer(dbType)) {
|
||||
return SQLSERVER__ALLTABLES_SQL;
|
||||
return SQL_SERVER_ALL_TABLES_SQL;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user