提交 d5bb9cb7 authored 作者: Thomas Mueller's avatar Thomas Mueller

H2 Console: indexes of tables of non-default schemas are now also listed.

上级 cf9550fe
......@@ -18,7 +18,8 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Issue 111: Multi-version concurrency / duplicate primary key after rollback.
<ul><li>H2 Console: indexes of tables of non-default schemas are now also listed.
</li><li>Issue 111: Multi-version concurrency / duplicate primary key after rollback.
</li><li>Issue 110: Multi-version concurrency / wrong exception is thrown.
</li><li>Parser: sequenceName.NEXTVAL and CURRVAL did not respect the schema search path.
</li><li>The following sequence could throw the exception "Row not found when trying to delete":
......
......@@ -716,7 +716,7 @@ class WebThread extends Thread implements DatabaseEventListener {
String columns;
}
private int addIndexes(DatabaseMetaData meta, String table, String schema, StringBuilder buff, int treeIndex)
private int addIndexes(boolean mainSchema, DatabaseMetaData meta, String table, String schema, StringBuilder buff, int treeIndex)
throws SQLException {
ResultSet rs = meta.getIndexInfo(null, schema, table, false, true);
HashMap<String, IndexInfo> indexMap = New.hashMap();
......@@ -749,15 +749,18 @@ class WebThread extends Thread implements DatabaseEventListener {
}
rs.close();
if (indexMap.size() > 0) {
buff.append("setNode(" + treeIndex + ", 1, 1, 'index_az', '${text.tree.indexes}', null);\n");
String level = mainSchema ? ", 1, 1" : ", 2, 1";
String levelIndex = mainSchema ? ", 2, 1" : ", 3, 1";
String levelColumnType = mainSchema ? ", 3, 2" : ", 4, 2";
buff.append("setNode(" + treeIndex + level + ", 'index_az', '${text.tree.indexes}', null);\n");
treeIndex++;
for (IndexInfo info : indexMap.values()) {
buff.append("setNode(" + treeIndex + ", 2, 1, 'index', '" + PageParser.escapeJavaScript(info.name)
buff.append("setNode(" + treeIndex + levelIndex + ", 'index', '" + PageParser.escapeJavaScript(info.name)
+ "', null);\n");
treeIndex++;
buff.append("setNode(" + treeIndex + ", 3, 2, 'type', '" + info.type + "', null);\n");
buff.append("setNode(" + treeIndex + levelColumnType + ", 'type', '" + info.type + "', null);\n");
treeIndex++;
buff.append("setNode(" + treeIndex + ", 3, 2, 'type', '" + PageParser.escapeJavaScript(info.columns)
buff.append("setNode(" + treeIndex + levelColumnType + ", 'type', '" + PageParser.escapeJavaScript(info.columns)
+ "', null);\n");
treeIndex++;
}
......@@ -798,8 +801,8 @@ class WebThread extends Thread implements DatabaseEventListener {
if (mainSchema || showColumns) {
StringBuilder columnsBuffer = new StringBuilder();
treeIndex = addColumns(mainSchema, table, buff, treeIndex, notManyTables, columnsBuffer);
if (mainSchema && !isOracle && notManyTables) {
treeIndex = addIndexes(meta, table.name, schema.name, buff, treeIndex);
if (!isOracle && notManyTables) {
treeIndex = addIndexes(mainSchema, meta, table.name, schema.name, buff, treeIndex);
}
buff.append("addTable('" + PageParser.escapeJavaScript(table.name) + "', '"
+ PageParser.escapeJavaScript(columnsBuffer.toString()) + "', " + tableId + ");\n");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论