【fix】对方法和局部变量重新命名
This commit is contained in:
+20
-20
@@ -43,44 +43,44 @@ public class DbReadTableUtil {
|
||||
|
||||
PrintStream printStream = System.out;
|
||||
new DbReadTableUtil();
|
||||
printStream.println(ArrayUtils.toString(a()));
|
||||
printStream.println(ArrayUtils.toString(listTableName()));
|
||||
}
|
||||
|
||||
public static List<String> a() throws SQLException {
|
||||
String var1 = null;
|
||||
ArrayList var2 = new ArrayList(0);
|
||||
public static List<String> listTableName() throws SQLException {
|
||||
String sqlStr = null;
|
||||
ArrayList list = new ArrayList(0);
|
||||
|
||||
try {
|
||||
Class.forName(CodeConfigProperties.driverName);
|
||||
connection = DriverManager.getConnection(CodeConfigProperties.databaseUrl, CodeConfigProperties.username, CodeConfigProperties.password);
|
||||
statement = connection.createStatement(1005, 1007);
|
||||
String var3 = connection.getCatalog();
|
||||
log.info(" connect databaseName : " + var3);
|
||||
String catalog = connection.getCatalog();
|
||||
log.info(" connect databaseName : " + catalog);
|
||||
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")) {
|
||||
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")) {
|
||||
var1 = "select tablename from pg_tables where schemaname='public'";
|
||||
sqlStr = "select tablename from pg_tables where schemaname='public'";
|
||||
}
|
||||
|
||||
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);
|
||||
ResultSet var0 = statement.executeQuery(var1);
|
||||
log.debug("--------------sql-------------" + sqlStr);
|
||||
ResultSet resultSet = statement.executeQuery(sqlStr);
|
||||
|
||||
while(var0.next()) {
|
||||
String var4 = var0.getString(1);
|
||||
var2.add(var4);
|
||||
while(resultSet.next()) {
|
||||
String tableName = resultSet.getString(1);
|
||||
list.add(tableName);
|
||||
}
|
||||
} catch (Exception var13) {
|
||||
var13.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (statement != null) {
|
||||
@@ -94,13 +94,13 @@ public class DbReadTableUtil {
|
||||
connection = null;
|
||||
System.gc();
|
||||
}
|
||||
} catch (SQLException var12) {
|
||||
throw var12;
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return var2;
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ColumnVo> a(String var0) throws Exception {
|
||||
|
||||
+1
-1
@@ -367,7 +367,7 @@ public class OnlCgformHeadController {
|
||||
|
||||
List var6;
|
||||
try {
|
||||
var6 = DbReadTableUtil.a();
|
||||
var6 = DbReadTableUtil.listTableName();
|
||||
} catch (SQLException var12) {
|
||||
log.error(var12.getMessage(), var12);
|
||||
return Result.error("同步失败,未获取数据库表信息");
|
||||
|
||||
Reference in New Issue
Block a user