提交 83579e6f authored 作者: Thomas Mueller's avatar Thomas Mueller

H2 Console: opening a MS SQL Server database is now faster. Also, listing the…

H2 Console: opening a MS SQL Server database is now faster. Also, listing the database meta data sometimes resulted in an exception.
上级 d99167aa
...@@ -72,6 +72,11 @@ public class DbContents { ...@@ -72,6 +72,11 @@ public class DbContents {
*/ */
boolean isSQLite; boolean isSQLite;
/**
* True if this is a MS SQL Server database.
*/
boolean isMSSQLServer;
/** /**
* True if the unquoted names are stored as upper case. * True if the unquoted names are stored as upper case.
* False for MySQL and PostgreSQL. * False for MySQL and PostgreSQL.
...@@ -101,7 +106,7 @@ public class DbContents { ...@@ -101,7 +106,7 @@ public class DbContents {
* *
* @param meta the database meta data * @param meta the database meta data
*/ */
void readContents(DatabaseMetaData meta) throws SQLException { synchronized void readContents(DatabaseMetaData meta) throws SQLException {
String prod = StringUtils.toLowerEnglish(meta.getDatabaseProductName()); String prod = StringUtils.toLowerEnglish(meta.getDatabaseProductName());
isSQLite = prod.indexOf("sqlite") >= 0; isSQLite = prod.indexOf("sqlite") >= 0;
String url = meta.getURL(); String url = meta.getURL();
...@@ -124,6 +129,7 @@ public class DbContents { ...@@ -124,6 +129,7 @@ public class DbContents {
isMySQL = url.startsWith("jdbc:mysql:"); isMySQL = url.startsWith("jdbc:mysql:");
isDerby = url.startsWith("jdbc:derby:"); isDerby = url.startsWith("jdbc:derby:");
isFirebird = url.startsWith("jdbc:firebirdsql:"); isFirebird = url.startsWith("jdbc:firebirdsql:");
isMSSQLServer = url.startsWith("jdbc:sqlserver:");
} }
storedUpperCaseIdentifiers = meta.storesUpperCaseIdentifiers(); storedUpperCaseIdentifiers = meta.storesUpperCaseIdentifiers();
String defaultSchemaName = getDefaultSchemaName(meta); String defaultSchemaName = getDefaultSchemaName(meta);
...@@ -178,6 +184,16 @@ public class DbContents { ...@@ -178,6 +184,16 @@ public class DbContents {
break; break;
} }
} }
} else if (isMSSQLServer) {
for (String ignore : new String[] {
"sys", "db_accessadmin", "db_backupoperator", "db_datareader", "db_datawriter", "db_ddladmin",
"db_denydatareader", "db_denydatawriter", "db_owner", "db_securityadmin"
}) {
if (ignore.equals(schema)) {
schema = null;
break;
}
}
} }
if (schema == null) { if (schema == null) {
continue; continue;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论