feat(dameng): show view validity and support recompilation

This commit is contained in:
guan xin authored and GitHub committed 2026-09-17 19:30:44 +08:00
1 parent e4bda693fb
commit 6b81a98453
71 files changed
+1040 -38

No files matched your search

@@ -10,7 +10,7 @@ public abstract class BaseDatabaseAgent implements DatabaseAgent {
public List<ObjectInfo> listObjects(String schema) {
List<ObjectInfo> result = new ArrayList<>();
for (TableInfo table : listTables(schema)) {
result.add(new ObjectInfo(table.getName(), table.getTable_type(), schema, table.getComment()));
result.add(new ObjectInfo(table.getName(), table.getTable_type(), schema, table.getComment(), table.getValid()));
}
return result;
}
@@ -56,7 +56,7 @@ public interface DatabaseAgent {
default List<ObjectInfo> listObjects(String schema) {
List<ObjectInfo> result = new ArrayList<>();
for (TableInfo table : listTables(schema)) {
result.add(new ObjectInfo(table.getName(), table.getTable_type(), schema, table.getComment()));
result.add(new ObjectInfo(table.getName(), table.getTable_type(), schema, table.getComment(), table.getValid()));
}
return result;
}
@@ -7,9 +7,10 @@ public final class ObjectInfo {
private String object_type;
private String schema;
private String comment;
private Boolean valid;
public ObjectInfo() {
this("", "", null, null);
this("", "", null, null, null);
}
public ObjectInfo(String name, String object_type) {
@@ -17,10 +18,15 @@ public final class ObjectInfo {
}
public ObjectInfo(String name, String object_type, String schema, String comment) {
this(name, object_type, schema, comment, null);
}
public ObjectInfo(String name, String object_type, String schema, String comment, Boolean valid) {
this.name = name;
this.object_type = object_type;
this.schema = schema;
this.comment = comment;
this.valid = valid;
}
public String getName() {
@@ -39,6 +45,10 @@ public final class ObjectInfo {
return comment;
}
public Boolean getValid() {
return valid;
}
public void setName(String name) {
this.name = name;
}
@@ -55,6 +65,10 @@ public final class ObjectInfo {
this.comment = comment;
}
public void setValid(Boolean valid) {
this.valid = valid;
}
@Override
public boolean equals(Object other) {
if (this == other) return true;
@@ -63,12 +77,13 @@ public final class ObjectInfo {
return Objects.equals(name, that.name)
&& Objects.equals(object_type, that.object_type)
&& Objects.equals(schema, that.schema)
&& Objects.equals(comment, that.comment);
&& Objects.equals(comment, that.comment)
&& Objects.equals(valid, that.valid);
}
@Override
public int hashCode() {
return Objects.hash(name, object_type, schema, comment);
return Objects.hash(name, object_type, schema, comment, valid);
}
@Override
@@ -77,6 +92,7 @@ public final class ObjectInfo {
+ ", object_type=" + object_type
+ ", schema=" + schema
+ ", comment=" + comment
+ ", valid=" + valid
+ ")";
}
}
@@ -206,7 +206,7 @@ public abstract class PostgresLikeAgent extends AbstractJdbcAgent {
return unchecked(() -> {
List<ObjectInfo> result = new ArrayList<>();
for (TableInfo table : listTables(schema)) {
result.add(new ObjectInfo(table.getName(), table.getTable_type(), schema, table.getComment()));
result.add(new ObjectInfo(table.getName(), table.getTable_type(), schema, table.getComment(), table.getValid()));
}
try (java.sql.PreparedStatement stmt = requireConnection().prepareStatement(
"SELECT p.proname AS routine_name, " +
@@ -115,7 +115,7 @@ public final class StandardJdbcMetadata {
public List<ObjectInfo> listObjects(List<TableInfo> tables, String schema, MetadataListConstraints constraints) {
List<ObjectInfo> result = new ArrayList<>();
for (TableInfo table : tables) {
result.add(new ObjectInfo(table.getName(), table.getTable_type(), schema, table.getComment()));
result.add(new ObjectInfo(table.getName(), table.getTable_type(), schema, table.getComment(), table.getValid()));
}
return MetadataListConstraints.orNone(constraints).filterObjects(result);
}
@@ -8,6 +8,7 @@ public final class TableInfo {
private String comment;
private String parent_schema;
private String parent_name;
private Boolean valid;
public TableInfo() {
this("", "", null);
@@ -22,11 +23,16 @@ public final class TableInfo {
}
public TableInfo(String name, String table_type, String comment, String parent_schema, String parent_name) {
this(name, table_type, comment, parent_schema, parent_name, null);
}
public TableInfo(String name, String table_type, String comment, String parent_schema, String parent_name, Boolean valid) {
this.name = name;
this.table_type = table_type;
this.comment = comment;
this.parent_schema = parent_schema;
this.parent_name = parent_name;
this.valid = valid;
}
public String getName() {
@@ -49,6 +55,10 @@ public final class TableInfo {
return parent_name;
}
public Boolean getValid() {
return valid;
}
public void setName(String name) {
this.name = name;
}
@@ -69,6 +79,10 @@ public final class TableInfo {
this.parent_name = parent_name;
}
public void setValid(Boolean valid) {
this.valid = valid;
}
@Override
public boolean equals(Object other) {
if (this == other) return true;
@@ -78,12 +92,13 @@ public final class TableInfo {
&& Objects.equals(table_type, that.table_type)
&& Objects.equals(comment, that.comment)
&& Objects.equals(parent_schema, that.parent_schema)
&& Objects.equals(parent_name, that.parent_name);
&& Objects.equals(parent_name, that.parent_name)
&& Objects.equals(valid, that.valid);
}
@Override
public int hashCode() {
return Objects.hash(name, table_type, comment, parent_schema, parent_name);
return Objects.hash(name, table_type, comment, parent_schema, parent_name, valid);
}
@Override
@@ -93,6 +108,7 @@ public final class TableInfo {
+ ", comment=" + comment
+ ", parent_schema=" + parent_schema
+ ", parent_name=" + parent_name
+ ", valid=" + valid
+ ")";
}
}