Mercurial > hg > monetdb-java
changeset 724:2b763b189452
Corrected DatabaseMetaData.getUDTs() output.
It used to return rows for system types: inet, json, url and uuid.
However those are not User Defined Types.
Now they are no longer returned by this method.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 19 Jan 2023 20:50:52 +0100 (2023-01-19) |
parents | 7200f7942b16 |
children | 224d73363dc9 |
files | ChangeLog src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java tests/JDBC_API_Tester.java |
diffstat | 3 files changed, 12 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog file for monetdb-java # This file is updated with Maddlog +* Thu Jan 19 2023 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> +- Corrected DatabaseMetaData.getUDTs() output. It used to return rows + for system types: inet, json, url and uuid. However those are not User + Defined Types. Now they are no longer returned by this method. + * Thu Dec 8 2022 Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> - Internal method waitForPrompt() of class BufferedMCLReader has been renamed to discardRemainder(). The example program SQLcopyinto.java
--- a/src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java +++ b/src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java @@ -3384,22 +3384,19 @@ public final class MonetDatabaseMetaData "s.\"name\" AS \"TYPE_SCHEM\", " + "t.\"sqlname\" AS \"TYPE_NAME\", " + "CASE t.\"sqlname\"" + - // next 4 UDTs are standard - " WHEN 'inet' THEN 'org.monetdb.jdbc.types.INET'" + - " WHEN 'json' THEN 'java.lang.String'" + - " WHEN 'url' THEN 'org.monetdb.jdbc.types.URL'" + - " WHEN 'uuid' THEN 'java.lang.String'" + // next UDT only when "CREATE TYPE xml EXTERNAL NAME xml;" is executed " WHEN 'xml' THEN 'java.lang.String'" + " ELSE 'java.lang.Object' END AS \"CLASS_NAME\", " + - "cast(CASE WHEN t.\"sqlname\" IN ('inet','json','url','uuid','xml') THEN ").append(Types.JAVA_OBJECT) + "cast(CASE WHEN t.\"sqlname\" = 'xml' THEN ").append(Types.JAVA_OBJECT) .append(" ELSE ").append(Types.STRUCT).append(" END AS int) AS \"DATA_TYPE\", " + "t.\"systemname\" AS \"REMARKS\", " + "cast(null as smallint) AS \"BASE_TYPE\" " + "FROM \"sys\".\"types\" t " + "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + - // exclude the built-in types (I assume they always have id <= 99 and eclass < 15) - "WHERE t.\"id\" > 99 AND t.\"eclass\" >= 15"); + // exclude the built-in types (I assume they always have id <= 99 and eclass < 18) + "WHERE t.\"id\" > 99" + + " AND t.\"eclass\" >= 18" + + " AND t.\"sqlname\" NOT IN ('inet','json','url','uuid')"); if (catalog != null && !catalog.isEmpty()) { // non-empty catalog selection.
--- a/tests/JDBC_API_Tester.java +++ b/tests/JDBC_API_Tester.java @@ -907,18 +907,14 @@ final public class JDBC_API_Tester { compareResultSet(dbmd.getUDTs(null, "sys", null, null), "getUDTs(null, sys, null, null)", "Resultset with 7 columns\n" + "TYPE_CAT TYPE_SCHEM TYPE_NAME CLASS_NAME DATA_TYPE REMARKS BASE_TYPE\n" + - "char(1) varchar(1024) varchar(1024) char(27) int varchar(256) smallint\n" + - "null sys inet org.monetdb.jdbc.types.INET 2000 inet null\n" + - "null sys json java.lang.String 2000 json null\n" + - "null sys url org.monetdb.jdbc.types.URL 2000 url null\n" + - "null sys uuid java.lang.String 2000 uuid null\n" + + "char(1) varchar(1024) varchar(1024) char(16) int varchar(256) smallint\n" + "null sys xml java.lang.String 2000 xml null\n"); int[] UDTtypes = { Types.STRUCT, Types.DISTINCT }; compareResultSet(dbmd.getUDTs(null, "sys", null, UDTtypes), "getUDTs(null, sys, null, UDTtypes", "Resultset with 7 columns\n" + "TYPE_CAT TYPE_SCHEM TYPE_NAME CLASS_NAME DATA_TYPE REMARKS BASE_TYPE\n" + - "char(1) varchar(1024) varchar(1024) char(27) int varchar(256) smallint\n"); + "char(1) varchar(1024) varchar(1024) char(16) int varchar(256) smallint\n"); sb.setLength(0); // clear the output log buffer } catch (SQLException e) {