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

New columns INFORMATION_SCHEMA.INDEXES.INDEX_CLASS and INFORMATION_SCHEMA.TABLES.TABLE_CLASS.

INFORMATION_SCHEMA.INDEXES.SQL now contains the CREATE INDEX statement instead of just the fully qualified index name.
上级 dff9575a
...@@ -36,6 +36,7 @@ import org.h2.expression.ValueExpression; ...@@ -36,6 +36,7 @@ import org.h2.expression.ValueExpression;
import org.h2.index.Index; import org.h2.index.Index;
import org.h2.index.IndexType; import org.h2.index.IndexType;
import org.h2.index.MetaIndex; import org.h2.index.MetaIndex;
import org.h2.index.MultiVersionIndex;
import org.h2.message.DbException; import org.h2.message.DbException;
import org.h2.result.Row; import org.h2.result.Row;
import org.h2.result.SearchRow; import org.h2.result.SearchRow;
...@@ -132,7 +133,8 @@ public class MetaTable extends Table { ...@@ -132,7 +133,8 @@ public class MetaTable extends Table {
"REMARKS", "REMARKS",
"LAST_MODIFICATION BIGINT", "LAST_MODIFICATION BIGINT",
"ID INT", "ID INT",
"TYPE_NAME" "TYPE_NAME",
"TABLE_CLASS"
); );
indexColumnName = "TABLE_NAME"; indexColumnName = "TABLE_NAME";
break; break;
...@@ -188,7 +190,8 @@ public class MetaTable extends Table { ...@@ -188,7 +190,8 @@ public class MetaTable extends Table {
"SQL", "SQL",
"ID INT", "ID INT",
"SORT_TYPE INT", "SORT_TYPE INT",
"CONSTRAINT_NAME" "CONSTRAINT_NAME",
"INDEX_CLASS"
); );
indexColumnName = "TABLE_NAME"; indexColumnName = "TABLE_NAME";
break; break;
...@@ -652,7 +655,9 @@ public class MetaTable extends Table { ...@@ -652,7 +655,9 @@ public class MetaTable extends Table {
// ID // ID
"" + table.getId(), "" + table.getId(),
// TYPE_NAME // TYPE_NAME
null null,
// TABLE_CLASS
table.getClass().getName()
); );
} }
break; break;
...@@ -753,6 +758,12 @@ public class MetaTable extends Table { ...@@ -753,6 +758,12 @@ public class MetaTable extends Table {
} }
} }
IndexColumn[] cols = index.getIndexColumns(); IndexColumn[] cols = index.getIndexColumns();
String indexClass;
if (index instanceof MultiVersionIndex) {
indexClass = ((MultiVersionIndex) index).getBaseIndex().getClass().getName();
} else {
indexClass = index.getClass().getName();
}
for (int k = 0; k < cols.length; k++) { for (int k = 0; k < cols.length; k++) {
IndexColumn idxCol = cols[k]; IndexColumn idxCol = cols[k];
Column column = idxCol.column; Column column = idxCol.column;
...@@ -790,13 +801,15 @@ public class MetaTable extends Table { ...@@ -790,13 +801,15 @@ public class MetaTable extends Table {
// REMARKS // REMARKS
replaceNullWithEmpty(index.getComment()), replaceNullWithEmpty(index.getComment()),
// SQL // SQL
index.getSQL(), index.getCreateSQL(),
// ID // ID
"" + index.getId(), "" + index.getId(),
// SORT_TYPE // SORT_TYPE
"" + idxCol.sortType, "" + idxCol.sortType,
// CONSTRAINT_NAME // CONSTRAINT_NAME
constraintName constraintName,
// INDEX_CLASS
indexClass
); );
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论