【fix】对方法和局部变量重新命名

This commit is contained in:
mzc5649
2021-04-01 14:25:54 +08:00
parent 3c6a96690e
commit 29ce535785
2 changed files with 21 additions and 21 deletions
@@ -43,44 +43,44 @@ public class DbReadTableUtil {
PrintStream printStream = System.out; PrintStream printStream = System.out;
new DbReadTableUtil(); new DbReadTableUtil();
printStream.println(ArrayUtils.toString(a())); printStream.println(ArrayUtils.toString(listTableName()));
} }
public static List<String> a() throws SQLException { public static List<String> listTableName() throws SQLException {
String var1 = null; String sqlStr = null;
ArrayList var2 = new ArrayList(0); ArrayList list = new ArrayList(0);
try { try {
Class.forName(CodeConfigProperties.driverName); Class.forName(CodeConfigProperties.driverName);
connection = DriverManager.getConnection(CodeConfigProperties.databaseUrl, CodeConfigProperties.username, CodeConfigProperties.password); connection = DriverManager.getConnection(CodeConfigProperties.databaseUrl, CodeConfigProperties.username, CodeConfigProperties.password);
statement = connection.createStatement(1005, 1007); statement = connection.createStatement(1005, 1007);
String var3 = connection.getCatalog(); String catalog = connection.getCatalog();
log.info(" connect databaseName : " + var3); log.info(" connect databaseName : " + catalog);
if (CodeConfigProperties.databaseType.equals("mysql")) { if (CodeConfigProperties.databaseType.equals("mysql")) {
var1 = MessageFormat.format("select distinct table_name from information_schema.columns where table_schema = {0}", TableConvert.c(var3)); sqlStr = MessageFormat.format("select distinct table_name from information_schema.columns where table_schema = {0}", TableConvert.c(catalog));
} }
if (CodeConfigProperties.databaseType.equals("oracle")) { if (CodeConfigProperties.databaseType.equals("oracle")) {
var1 = " select distinct colstable.table_name as table_name from user_tab_cols colstable order by colstable.table_name"; sqlStr = " select distinct colstable.table_name as table_name from user_tab_cols colstable order by colstable.table_name";
} }
if (CodeConfigProperties.databaseType.equals("postgresql")) { if (CodeConfigProperties.databaseType.equals("postgresql")) {
var1 = "select tablename from pg_tables where schemaname='public'"; sqlStr = "select tablename from pg_tables where schemaname='public'";
} }
if (CodeConfigProperties.databaseType.equals("sqlserver")) { if (CodeConfigProperties.databaseType.equals("sqlserver")) {
var1 = "select distinct c.name as table_name from sys.objects c where c.type = 'U' "; sqlStr = "select distinct c.name as table_name from sys.objects c where c.type = 'U' ";
} }
log.debug("--------------sql-------------" + var1); log.debug("--------------sql-------------" + sqlStr);
ResultSet var0 = statement.executeQuery(var1); ResultSet resultSet = statement.executeQuery(sqlStr);
while(var0.next()) { while(resultSet.next()) {
String var4 = var0.getString(1); String tableName = resultSet.getString(1);
var2.add(var4); list.add(tableName);
} }
} catch (Exception var13) { } catch (Exception e) {
var13.printStackTrace(); e.printStackTrace();
} finally { } finally {
try { try {
if (statement != null) { if (statement != null) {
@@ -94,13 +94,13 @@ public class DbReadTableUtil {
connection = null; connection = null;
System.gc(); System.gc();
} }
} catch (SQLException var12) { } catch (SQLException e) {
throw var12; throw e;
} }
} }
return var2; return list;
} }
public static List<ColumnVo> a(String var0) throws Exception { public static List<ColumnVo> a(String var0) throws Exception {
@@ -367,7 +367,7 @@ public class OnlCgformHeadController {
List var6; List var6;
try { try {
var6 = DbReadTableUtil.a(); var6 = DbReadTableUtil.listTableName();
} catch (SQLException var12) { } catch (SQLException var12) {
log.error(var12.getMessage(), var12); log.error(var12.getMessage(), var12);
return Result.error("同步失败,未获取数据库表信息"); return Result.error("同步失败,未获取数据库表信息");