提交 aabd4a1b authored 作者: noelgrandin's avatar noelgrandin

Follow JDBC specification on Procedures MetaData, use P0 as return type of procedure.

上级 5985e7be
......@@ -36,6 +36,8 @@ Change Log
</li><li>Remove the "h2.MAX_MEMORY_ROWS_DISTINCT" system property to reduce confusion.
We already have the MAX_MEMORY_ROWS setting which does a very similar thing, and is better documented.
</li><li>Issue 554: Web Console in an IFrame was not fully supported.
</li><li>Follow JDBC specification on Procedures MetaData, use P0 as
return type of procedure.
</li></ul>
<h2>Version 1.4.177 Beta (2014-04-12)</h2>
......
......@@ -1235,6 +1235,46 @@ public class MetaTable extends Table {
database.getAllSchemaObjects(DbObject.FUNCTION_ALIAS)) {
FunctionAlias alias = (FunctionAlias) aliasAsSchemaObject;
for (FunctionAlias.JavaMethod method : alias.getJavaMethods()) {
// Add return column index 0
if(method.getDataType() != Value.NULL) {
DataType dt = DataType.getDataType(method.getDataType());
add(rows,
// ALIAS_CATALOG
catalog,
// ALIAS_SCHEMA
alias.getSchema().getName(),
// ALIAS_NAME
identifier(alias.getName()),
// JAVA_CLASS
alias.getJavaClassName(),
// JAVA_METHOD
alias.getJavaMethodName(),
// COLUMN_COUNT
"" + method.getParameterCount(),
// POS INT
"0",
// COLUMN_NAME
"P0",
// DATA_TYPE
"" + DataType.convertTypeToSQLType(method.getDataType()),
// TYPE_NAME
dt.name,
// PRECISION INT
"" + MathUtils.convertLongToInt(dt.defaultPrecision),
// SCALE
"" + dt.defaultScale,
// RADIX
"10",
// NULLABLE SMALLINT
"" + DatabaseMetaData.columnNullableUnknown,
// COLUMN_TYPE
"" + DatabaseMetaData.procedureColumnReturn,
// REMARKS
"",
// COLUMN_DEFAULT
null
);
}
Class<?>[] columnList = method.getColumnClasses();
for (int k = 0; k < columnList.length; k++) {
if (method.hasConnectionParam() && k == 0) {
......
......@@ -544,6 +544,8 @@ public class TestFunctions extends TestBase implements AggregateFunction {
DatabaseMetaData meta = conn.getMetaData();
rs = meta.getProcedureColumns(null, null, "MEAN2", null);
assertTrue(rs.next());
assertEquals("P0", rs.getString("COLUMN_NAME"));
assertTrue(rs.next());
assertEquals("FUNCTIONS", rs.getString("PROCEDURE_CAT"));
assertEquals("PUBLIC", rs.getString("PROCEDURE_SCHEM"));
assertEquals("MEAN2", rs.getString("PROCEDURE_NAME"));
......@@ -768,6 +770,8 @@ public class TestFunctions extends TestBase implements AggregateFunction {
DatabaseMetaData meta = conn.getMetaData();
rs = meta.getProcedureColumns(null, null, "ADD_ROW", null);
assertTrue(rs.next());
assertEquals("P0", rs.getString("COLUMN_NAME"));
assertTrue(rs.next());
assertEquals("FUNCTIONS", rs.getString("PROCEDURE_CAT"));
assertEquals("PUBLIC", rs.getString("PROCEDURE_SCHEM"));
assertEquals("ADD_ROW", rs.getString("PROCEDURE_NAME"));
......@@ -1017,6 +1021,8 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertEquals("NULL_RESULT", rs.getString("SPECIFIC_NAME"));
rs = meta.getProcedureColumns(null, null, "NULL_RESULT", null);
assertTrue(rs.next());
assertEquals("P0", rs.getString("COLUMN_NAME"));
assertFalse(rs.next());
stat.execute("CREATE ALIAS RESULT_WITH_NULL FOR \"" +
......
......@@ -243,6 +243,11 @@ public class TestMetaData extends TestBase {
"" + DatabaseMetaData.procedureColumnIn,
"" + Types.INTEGER, "INTEGER", "10", "10", "0", "10",
"" + DatabaseMetaData.procedureNoNulls },
{ CATALOG, Constants.SCHEMA_MAIN, "PROP", "P0",
"" + DatabaseMetaData.procedureColumnReturn,
"" + Types.VARCHAR, "VARCHAR", "" + Integer.MAX_VALUE,
"" + Integer.MAX_VALUE, "0", "10",
"" + DatabaseMetaData.procedureNullableUnknown },
{ CATALOG, Constants.SCHEMA_MAIN, "PROP", "P1",
"" + DatabaseMetaData.procedureColumnIn,
"" + Types.VARCHAR, "VARCHAR", "" + Integer.MAX_VALUE,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论