提交 7eb40855 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 7430fb79
...@@ -37,7 +37,9 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -37,7 +37,9 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>Version 1.0 (Current)</h3> <h3>Version 1.0 (Current)</h3>
<h3>Version 1.0 / TODO (Build TODO)</h3><ul> <h3>Version 1.0 / TODO (Build TODO)</h3><ul>
<li>If large result sets (backed by a temporary file) where not closed, the file was not deleted. <li>New column ID for INFORMATION_SCHEMA.INDEXES, SEQUENCES, USERS, ROLES, RIGHTS,
FUNCTION_ALIASES, SCHEMATA, VIEWS, CONSTRAINTS, CONSTANTS, DOMAINS, TRIGGERS.
</li><li>If large result sets (backed by a temporary file) where not closed, the file was not deleted.
Now, the default result set type is FETCH_FORWARD. This means temp files are deleted Now, the default result set type is FETCH_FORWARD. This means temp files are deleted
automatically (without having to close the result set explicitly). But it also means automatically (without having to close the result set explicitly). But it also means
ResultSet.beforeFirst can only be called for scrollable result sets. To create a scrollable resut set, ResultSet.beforeFirst can only be called for scrollable result sets. To create a scrollable resut set,
......
...@@ -614,7 +614,7 @@ public class Database implements DataHandler { ...@@ -614,7 +614,7 @@ public class Database implements DataHandler {
} }
private void addMetaData(int type) throws SQLException { private void addMetaData(int type) throws SQLException {
MetaTable m = new MetaTable(infoSchema, type); MetaTable m = new MetaTable(infoSchema, -1-type, type);
infoSchema.add(m); infoSchema.add(m);
} }
......
...@@ -71,9 +71,9 @@ public class MetaTable extends Table { ...@@ -71,9 +71,9 @@ public class MetaTable extends Table {
private MetaIndex index; private MetaIndex index;
private int indexColumn; private int indexColumn;
public MetaTable(Schema schema, int type) throws SQLException { public MetaTable(Schema schema, int id, int type) throws SQLException {
// tableName will be set later // tableName will be set later
super(schema, 0, null, true); super(schema, id, null, true);
this.type = type; this.type = type;
Column[] cols; Column[] cols;
String indexColumnName = null; String indexColumnName = null;
...@@ -139,7 +139,8 @@ public class MetaTable extends Table { ...@@ -139,7 +139,8 @@ public class MetaTable extends Table {
"ASC_OR_DESC", "ASC_OR_DESC",
"PAGES INT", "PAGES INT",
"FILTER_CONDITION", "FILTER_CONDITION",
"REMARKS" "REMARKS",
"ID INT"
}); });
indexColumnName = "TABLE_NAME"; indexColumnName = "TABLE_NAME";
break; break;
...@@ -197,7 +198,8 @@ public class MetaTable extends Table { ...@@ -197,7 +198,8 @@ public class MetaTable extends Table {
"CURRENT_VALUE BIGINT", "CURRENT_VALUE BIGINT",
"INCREMENT BIGINT", "INCREMENT BIGINT",
"IS_GENERATED BIT", "IS_GENERATED BIT",
"REMARKS" "REMARKS",
"ID INT"
}); });
break; break;
case USERS: case USERS:
...@@ -205,14 +207,16 @@ public class MetaTable extends Table { ...@@ -205,14 +207,16 @@ public class MetaTable extends Table {
cols = createColumns(new String[]{ cols = createColumns(new String[]{
"NAME", "NAME",
"ADMIN", "ADMIN",
"REMARKS" "REMARKS",
"ID INT"
}); });
break; break;
case ROLES: case ROLES:
setObjectName("ROLES"); setObjectName("ROLES");
cols = createColumns(new String[]{ cols = createColumns(new String[]{
"NAME", "NAME",
"REMARKS" "REMARKS",
"ID INT"
}); });
break; break;
case RIGHTS: case RIGHTS:
...@@ -223,7 +227,8 @@ public class MetaTable extends Table { ...@@ -223,7 +227,8 @@ public class MetaTable extends Table {
"GRANTEDROLE", "GRANTEDROLE",
"RIGHTS", "RIGHTS",
"TABLE_SCHEMA", "TABLE_SCHEMA",
"TABLE_NAME" "TABLE_NAME",
"ID INT"
}); });
indexColumnName = "TABLE_NAME"; indexColumnName = "TABLE_NAME";
break; break;
...@@ -238,7 +243,8 @@ public class MetaTable extends Table { ...@@ -238,7 +243,8 @@ public class MetaTable extends Table {
"DATA_TYPE INT", "DATA_TYPE INT",
"COLUMN_COUNT INT", "COLUMN_COUNT INT",
"RETURNS_RESULT SMALLINT", "RETURNS_RESULT SMALLINT",
"REMARKS" "REMARKS",
"ID INT"
}); });
break; break;
case FUNCTION_COLUMNS: case FUNCTION_COLUMNS:
...@@ -270,7 +276,8 @@ public class MetaTable extends Table { ...@@ -270,7 +276,8 @@ public class MetaTable extends Table {
"DEFAULT_CHARACTER_SET_NAME", "DEFAULT_CHARACTER_SET_NAME",
"DEFAULT_COLLATION_NAME", "DEFAULT_COLLATION_NAME",
"IS_DEFAULT BIT", "IS_DEFAULT BIT",
"REMARKS" "REMARKS",
"ID INT"
}); });
break; break;
case TABLE_PRIVILEGES: case TABLE_PRIVILEGES:
...@@ -317,7 +324,8 @@ public class MetaTable extends Table { ...@@ -317,7 +324,8 @@ public class MetaTable extends Table {
"CHECK_OPTION", "CHECK_OPTION",
"IS_UPDATABLE", "IS_UPDATABLE",
"STATUS", "STATUS",
"REMARKS" "REMARKS",
"ID INT"
}); });
indexColumnName = "TABLE_NAME"; indexColumnName = "TABLE_NAME";
break; break;
...@@ -362,6 +370,7 @@ public class MetaTable extends Table { ...@@ -362,6 +370,7 @@ public class MetaTable extends Table {
"COLUMN_LIST", "COLUMN_LIST",
"REMARKS", "REMARKS",
"SQL", "SQL",
"ID INT"
}); });
indexColumnName = "TABLE_NAME"; indexColumnName = "TABLE_NAME";
break; break;
...@@ -374,6 +383,7 @@ public class MetaTable extends Table { ...@@ -374,6 +383,7 @@ public class MetaTable extends Table {
"DATA_TYPE SMALLINT", "DATA_TYPE SMALLINT",
"REMARKS", "REMARKS",
"SQL", "SQL",
"ID INT"
}); });
break; break;
case DOMAINS: case DOMAINS:
...@@ -392,6 +402,7 @@ public class MetaTable extends Table { ...@@ -392,6 +402,7 @@ public class MetaTable extends Table {
"CHECK_CONSTRAINT", "CHECK_CONSTRAINT",
"REMARKS", "REMARKS",
"SQL", "SQL",
"ID INT"
}); });
break; break;
case TRIGGERS: case TRIGGERS:
...@@ -410,6 +421,7 @@ public class MetaTable extends Table { ...@@ -410,6 +421,7 @@ public class MetaTable extends Table {
"NO_WAIT BIT", "NO_WAIT BIT",
"REMARKS", "REMARKS",
"SQL", "SQL",
"ID INT"
}); });
break; break;
default: default:
...@@ -614,7 +626,8 @@ public class MetaTable extends Table { ...@@ -614,7 +626,8 @@ public class MetaTable extends Table {
"A", // ASC_OR_DESC "A", // ASC_OR_DESC
"0", // PAGES "0", // PAGES
"", // FILTER_CONDITION "", // FILTER_CONDITION
replaceNullWithEmpty(index.getComment()) // REMARKS replaceNullWithEmpty(index.getComment()), // REMARKS
"" + index.getId() // ID
}); });
} }
} }
...@@ -760,7 +773,8 @@ public class MetaTable extends Table { ...@@ -760,7 +773,8 @@ public class MetaTable extends Table {
String.valueOf(s.getCurrentValue()), // CURRENT_VALUE String.valueOf(s.getCurrentValue()), // CURRENT_VALUE
String.valueOf(s.getIncrement()), // INCREMENT String.valueOf(s.getIncrement()), // INCREMENT
s.getBelongsToTable() ? "TRUE" : "FALSE", // IS_GENERATED s.getBelongsToTable() ? "TRUE" : "FALSE", // IS_GENERATED
replaceNullWithEmpty(s.getComment()) // REMARKS replaceNullWithEmpty(s.getComment()), // REMARKS
"" + s.getId() // ID
}); });
} }
break; break;
...@@ -772,7 +786,8 @@ public class MetaTable extends Table { ...@@ -772,7 +786,8 @@ public class MetaTable extends Table {
add(rows,new String[]{ add(rows,new String[]{
identifier(u.getName()), // NAME identifier(u.getName()), // NAME
String.valueOf(u.getAdmin()), // ADMIN String.valueOf(u.getAdmin()), // ADMIN
replaceNullWithEmpty(u.getComment()) // REMARKS replaceNullWithEmpty(u.getComment()), // REMARKS
"" + u.getId() //
}); });
} }
break; break;
...@@ -783,7 +798,8 @@ public class MetaTable extends Table { ...@@ -783,7 +798,8 @@ public class MetaTable extends Table {
Role r = (Role) roles.get(i); Role r = (Role) roles.get(i);
add(rows,new String[]{ add(rows,new String[]{
identifier(r.getName()), // NAME identifier(r.getName()), // NAME
replaceNullWithEmpty(r.getComment()) // REMARKS replaceNullWithEmpty(r.getComment()), // REMARKS
"" + r.getId() // ID
}); });
} }
break; break;
...@@ -792,7 +808,6 @@ public class MetaTable extends Table { ...@@ -792,7 +808,6 @@ public class MetaTable extends Table {
ObjectArray rights = database.getAllRights(); ObjectArray rights = database.getAllRights();
for(int i=0; i<rights.size(); i++) { for(int i=0; i<rights.size(); i++) {
Right r = (Right) rights.get(i); Right r = (Right) rights.get(i);
// "GRANTEE", "GRANTEETYPE", "GRANTEDROLE", "RIGHTS", "TABLE"
Role role = r.getGrantedRole(); Role role = r.getGrantedRole();
DbObject grantee = r.getGrantee(); DbObject grantee = r.getGrantee();
String type = grantee.getType() == DbObject.USER ? "USER" : "ROLE"; String type = grantee.getType() == DbObject.USER ? "USER" : "ROLE";
...@@ -803,21 +818,23 @@ public class MetaTable extends Table { ...@@ -803,21 +818,23 @@ public class MetaTable extends Table {
continue; continue;
} }
add(rows,new String[]{ add(rows,new String[]{
identifier(grantee.getName()), identifier(grantee.getName()), // GRANTEE
type, type, // GRANTEETYPE
"", "", // GRANTEDROLE
r.getRights(), r.getRights(), // RIGHTS
identifier(granted.getSchema().getName()), identifier(granted.getSchema().getName()), // TABLE_SCHEMA
identifier(granted.getName()) identifier(granted.getName()), // TABLE_NAME
"" + r.getId() // ID
}); });
} else { } else {
add(rows,new String[]{ add(rows,new String[]{
identifier(grantee.getName()), identifier(grantee.getName()), // GRANTEE
type, type, // GRANTEETYPE
identifier(role.getName()), identifier(role.getName()), // GRANTEDROLE
"", "", // RIGHTS
"", "", // TABLE_SCHEMA
"" "", // TABLE_NAME
"" + r.getId() // ID
}); });
} }
} }
...@@ -837,7 +854,8 @@ public class MetaTable extends Table { ...@@ -837,7 +854,8 @@ public class MetaTable extends Table {
""+DataType.convertTypeToSQLType(alias.getDataType()), // DATA_TYPE ""+DataType.convertTypeToSQLType(alias.getDataType()), // DATA_TYPE
""+ alias.getColumnClasses().length, // COLUMN_COUNT INT ""+ alias.getColumnClasses().length, // COLUMN_COUNT INT
""+ returnsResult, // RETURNS_RESULT SMALLINT ""+ returnsResult, // RETURNS_RESULT SMALLINT
replaceNullWithEmpty(alias.getComment()) // REMARKS replaceNullWithEmpty(alias.getComment()), // REMARKS
"" + alias.getId() // ID
}); });
} }
break; break;
...@@ -885,7 +903,8 @@ public class MetaTable extends Table { ...@@ -885,7 +903,8 @@ public class MetaTable extends Table {
Constants.CHARACTER_SET_NAME, // DEFAULT_CHARACTER_SET_NAME Constants.CHARACTER_SET_NAME, // DEFAULT_CHARACTER_SET_NAME
collation, // DEFAULT_COLLATION_NAME collation, // DEFAULT_COLLATION_NAME
Constants.SCHEMA_MAIN.equals(schema.getName()) ? "TRUE" : "FALSE", // IS_DEFAULT Constants.SCHEMA_MAIN.equals(schema.getName()) ? "TRUE" : "FALSE", // IS_DEFAULT
replaceNullWithEmpty(schema.getComment()) // REMARKS replaceNullWithEmpty(schema.getComment()), // REMARKS
"" + schema.getId() // ID
}); });
} }
break; break;
...@@ -959,7 +978,8 @@ public class MetaTable extends Table { ...@@ -959,7 +978,8 @@ public class MetaTable extends Table {
"NONE", // CHECK_OPTION "NONE", // CHECK_OPTION
"NO", // IS_UPDATABLE "NO", // IS_UPDATABLE
view.getInvalid() ? "INVALID" : "VALID", // STATUS view.getInvalid() ? "INVALID" : "VALID", // STATUS
replaceNullWithEmpty(view.getComment()) // REMARKS replaceNullWithEmpty(view.getComment()), // REMARKS
"" + view.getId() // ID
}); });
} }
break; break;
...@@ -1056,6 +1076,7 @@ public class MetaTable extends Table { ...@@ -1056,6 +1076,7 @@ public class MetaTable extends Table {
columnList, // COLUMN_LIST columnList, // COLUMN_LIST
replaceNullWithEmpty(constraint.getComment()), // REMARKS replaceNullWithEmpty(constraint.getComment()), // REMARKS
constraint.getCreateSQL(), // SQL constraint.getCreateSQL(), // SQL
"" + constraint.getId() // ID
}); });
} }
break; break;
...@@ -1072,6 +1093,7 @@ public class MetaTable extends Table { ...@@ -1072,6 +1093,7 @@ public class MetaTable extends Table {
"" + DataType.convertTypeToSQLType(expr.getType()), // CONSTANT_TYPE "" + DataType.convertTypeToSQLType(expr.getType()), // CONSTANT_TYPE
replaceNullWithEmpty(constant.getComment()), // REMARKS replaceNullWithEmpty(constant.getComment()), // REMARKS
expr.getSQL(), // SQL expr.getSQL(), // SQL
"" + constant.getId() // ID
}); });
} }
break; break;
...@@ -1094,7 +1116,8 @@ public class MetaTable extends Table { ...@@ -1094,7 +1116,8 @@ public class MetaTable extends Table {
"" + col.getSelectivity(), // SELECTIVITY INT "" + col.getSelectivity(), // SELECTIVITY INT
"" + col.getCheckConstraintSQL(session, "VALUE"), // CHECK_CONSTRAINT "" + col.getCheckConstraintSQL(session, "VALUE"), // CHECK_CONSTRAINT
replaceNullWithEmpty(dt.getComment()), // REMARKS replaceNullWithEmpty(dt.getComment()), // REMARKS
"" + dt.getCreateSQL() // SQL "" + dt.getCreateSQL(), // SQL
"" + dt.getId() // ID
}); });
} }
break; break;
...@@ -1117,7 +1140,8 @@ public class MetaTable extends Table { ...@@ -1117,7 +1140,8 @@ public class MetaTable extends Table {
"" + trigger.getQueueSize(), // QUEUE_SIZE INT "" + trigger.getQueueSize(), // QUEUE_SIZE INT
"" + trigger.getNoWait(), // NO_WAIT BIT "" + trigger.getNoWait(), // NO_WAIT BIT
replaceNullWithEmpty(trigger.getComment()), // REMARKS replaceNullWithEmpty(trigger.getComment()), // REMARKS
trigger.getSQL() // SQL trigger.getSQL(), // SQL
"" + trigger.getId() // ID
}); });
} }
break; break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论