提交 13135e81 authored 作者: Thomas Mueller's avatar Thomas Mueller

DatabaseMetaData.getProcedures and getProcedureColumns could throw an exception…

DatabaseMetaData.getProcedures and getProcedureColumns could throw an exception if a user defined class is not available.
上级 46dc1deb
...@@ -26,6 +26,7 @@ import org.h2.engine.Constants; ...@@ -26,6 +26,7 @@ import org.h2.engine.Constants;
import org.h2.engine.Database; import org.h2.engine.Database;
import org.h2.engine.DbObject; import org.h2.engine.DbObject;
import org.h2.engine.FunctionAlias; import org.h2.engine.FunctionAlias;
import org.h2.engine.FunctionAlias.JavaMethod;
import org.h2.engine.QueryStatisticsData; import org.h2.engine.QueryStatisticsData;
import org.h2.engine.Right; import org.h2.engine.Right;
import org.h2.engine.Role; import org.h2.engine.Role;
...@@ -1172,7 +1173,13 @@ public class MetaTable extends Table { ...@@ -1172,7 +1173,13 @@ public class MetaTable extends Table {
for (SchemaObject aliasAsSchemaObject : for (SchemaObject aliasAsSchemaObject :
database.getAllSchemaObjects(DbObject.FUNCTION_ALIAS)) { database.getAllSchemaObjects(DbObject.FUNCTION_ALIAS)) {
FunctionAlias alias = (FunctionAlias) aliasAsSchemaObject; FunctionAlias alias = (FunctionAlias) aliasAsSchemaObject;
for (FunctionAlias.JavaMethod method : alias.getJavaMethods()) { JavaMethod[] methods;
try {
methods = alias.getJavaMethods();
} catch (DbException e) {
methods = new JavaMethod[0];
}
for (FunctionAlias.JavaMethod method : methods) {
int returnsResult = method.getDataType() == Value.NULL ? int returnsResult = method.getDataType() == Value.NULL ?
DatabaseMetaData.procedureNoResult : DatabaseMetaData.procedureNoResult :
DatabaseMetaData.procedureReturnsResult; DatabaseMetaData.procedureReturnsResult;
...@@ -1241,7 +1248,13 @@ public class MetaTable extends Table { ...@@ -1241,7 +1248,13 @@ public class MetaTable extends Table {
for (SchemaObject aliasAsSchemaObject : for (SchemaObject aliasAsSchemaObject :
database.getAllSchemaObjects(DbObject.FUNCTION_ALIAS)) { database.getAllSchemaObjects(DbObject.FUNCTION_ALIAS)) {
FunctionAlias alias = (FunctionAlias) aliasAsSchemaObject; FunctionAlias alias = (FunctionAlias) aliasAsSchemaObject;
for (FunctionAlias.JavaMethod method : alias.getJavaMethods()) { JavaMethod[] methods;
try {
methods = alias.getJavaMethods();
} catch (DbException e) {
methods = new JavaMethod[0];
}
for (FunctionAlias.JavaMethod method : methods) {
// Add return column index 0 // Add return column index 0
if (method.getDataType() != Value.NULL) { if (method.getDataType() != Value.NULL) {
DataType dt = DataType.getDataType(method.getDataType()); DataType dt = DataType.getDataType(method.getDataType());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论