Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a58d885

Browse files
committed
Server:避免全局默认的 @Schema 自动填充进来导致 Table,Column,PgClass,PgAttribute 的 schema 错误,查不到文档
1 parent 0816d98 commit a58d885

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

APIJSON-Java-Server/APIJSONORM/src/main/java/zuo/biao/apijson/server/AbstractSQLConfig.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,17 @@ public String getSchema() {
228228
return schema;
229229
}
230230
public String getSQLSchema(String sqlTable) {
231+
//强制,避免因为全局默认的 @schema 自动填充进来,导致这几个类的 schema 为 sys 等其它值
232+
if ((Table.TABLE_NAME.equals(sqlTable) || Column.TABLE_NAME.equals(sqlTable)) ) {
233+
return SCHEMA_INFORMATION;
234+
}
235+
if ((PgAttribute.TABLE_NAME.equals(sqlTable) || PgClass.TABLE_NAME.equals(sqlTable)) ) {
236+
return "";
237+
}
238+
231239
String sch = getSchema();
232240
if (sch == null) { //PostgreSQL 的 pg_class 和 pg_attribute 表好像不属于任何 Schema StringUtil.isEmpty(sch, true)) {
233-
if ((Table.TABLE_NAME.equals(sqlTable) || Column.TABLE_NAME.equals(sqlTable)) ) {
234-
sch = SCHEMA_INFORMATION;
235-
}
236-
else if ((PgAttribute.TABLE_NAME.equals(sqlTable) || PgClass.TABLE_NAME.equals(sqlTable)) ) {
237-
sch = "";
238-
}
239-
else {
240-
sch = DEFAULT_SCHEMA;
241-
}
241+
sch = DEFAULT_SCHEMA;
242242
}
243243
return sch;
244244
}

0 commit comments

Comments
 (0)