Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

批量构建任务时,mysql无法获取表列表问题修复 #518

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public String getSQLQueryTables() {
}

@Override
public String getSQLQueryTables(String... tableSchema) {
public String getSQLQueryTables(String tableSchema) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public String getSQLQueryTables() {
}

@Override
public String getSQLQueryTables(String... tableSchema) {
return String.format("SELECT TABNAME, REMARKS FROM SYSCAT.TABLES WHERE TABSCHEMA = '%s'", tableSchema[0]);
public String getSQLQueryTables(String tableSchema) {
return String.format("SELECT TABNAME, REMARKS FROM SYSCAT.TABLES WHERE TABSCHEMA = '%s'", tableSchema);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface DatabaseInterface {
* @param tableSchema
* @return
*/
String getSQLQueryTables(String... tableSchema);
String getSQLQueryTables(String tableSchema);


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public String getSQLQueryTables() {
}

@Override
public String getSQLQueryTables(String... tableSchema) {
return "show tables";
public String getSQLQueryTables(String tableSchema) {
return String.format("show tables FROM %s", tableSchema);
}

@Override
Expand All @@ -59,4 +59,5 @@ public String getSQLQueryColumns(String... args) {
public String getSQLQueryTableSchema(String... args) {
return "show databases";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public String getSQLQueryTableNameComment() {
}

@Override
public String getSQLQueryTables(String... tableSchema) {
return "select owner||'.'||table_name as table_name from all_tables where owner='" + tableSchema[0] + "' " +
public String getSQLQueryTables(String tableSchema) {
return "select owner||'.'||table_name as table_name from all_tables where owner='" + tableSchema + "' " +
"union " +
"select (owner||'.'||view_name) as table_name from all_views where owner='" + tableSchema[0] + "'" +
"select (owner||'.'||view_name) as table_name from all_views where owner='" + tableSchema + "'" +
"order by table_name";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public String getSQLQueryTableNameComment() {
}

@Override
public String getSQLQueryTables(String... tableSchema) {
return "select table_name from dba_tables where owner='" + tableSchema[0] + "'";
public String getSQLQueryTables(String tableSchema) {
return "select table_name from dba_tables where owner='" + tableSchema + "'";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public String getSQLQueryTables() {


@Override
public String getSQLQueryTables(String... tableSchema) {
public String getSQLQueryTables(String tableSchema) {
return "SELECT concat_ws('.',\"table_schema\",\"table_name\") FROM information_schema.tables \n" +
"where \"table_schema\" not in ('pg_toast','pg_temp_1','pg_toast_temp_1','pg_catalog','information_schema','gp_toolkit','pg_aoseg','pg_bitmapindex') \n" +
"and table_type='BASE TABLE' and table_schema='" + tableSchema[0] + "' order by table_name";
"and table_type='BASE TABLE' and table_schema='" + tableSchema + "' order by table_name";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public String getSQLQueryTables() {
}

@Override
public String getSQLQueryTables(String... tableSchema) {
public String getSQLQueryTables(String tableSchema) {
return "select schema_name(schema_id)+'.'+object_name(object_id) from sys.objects \n" +
"where type ='U' \n" +
"and schema_name(schema_id) ='" + tableSchema[0] + "'";
"and schema_name(schema_id) ='" + tableSchema + "'";

}

Expand Down
12 changes: 11 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<fastjson.version>1.2.70</fastjson.version>
<slf4j-api.version>1.7.28</slf4j-api.version>
<logback-classic.version>1.2.2</logback-classic.version>
<log4j.version>2.15.0</log4j.version>
<log4j.version>2.19.0</log4j.version>
<commons-io.version>2.4</commons-io.version>
<junit.version>4.12</junit.version>
<hutool.version>5.7.2</hutool.version>
Expand Down Expand Up @@ -76,6 +76,16 @@
<artifactId>log4j-web</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
Expand Down