comparison src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java @ 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 aeb268156580
children ee061ab9ee32
comparison
equal deleted inserted replaced
723:7200f7942b16 724:2b763b189452
3382 } 3382 }
3383 query.append("SELECT cast(null as char(1)) AS \"TYPE_CAT\", " + 3383 query.append("SELECT cast(null as char(1)) AS \"TYPE_CAT\", " +
3384 "s.\"name\" AS \"TYPE_SCHEM\", " + 3384 "s.\"name\" AS \"TYPE_SCHEM\", " +
3385 "t.\"sqlname\" AS \"TYPE_NAME\", " + 3385 "t.\"sqlname\" AS \"TYPE_NAME\", " +
3386 "CASE t.\"sqlname\"" + 3386 "CASE t.\"sqlname\"" +
3387 // next 4 UDTs are standard
3388 " WHEN 'inet' THEN 'org.monetdb.jdbc.types.INET'" +
3389 " WHEN 'json' THEN 'java.lang.String'" +
3390 " WHEN 'url' THEN 'org.monetdb.jdbc.types.URL'" +
3391 " WHEN 'uuid' THEN 'java.lang.String'" +
3392 // next UDT only when "CREATE TYPE xml EXTERNAL NAME xml;" is executed 3387 // next UDT only when "CREATE TYPE xml EXTERNAL NAME xml;" is executed
3393 " WHEN 'xml' THEN 'java.lang.String'" + 3388 " WHEN 'xml' THEN 'java.lang.String'" +
3394 " ELSE 'java.lang.Object' END AS \"CLASS_NAME\", " + 3389 " ELSE 'java.lang.Object' END AS \"CLASS_NAME\", " +
3395 "cast(CASE WHEN t.\"sqlname\" IN ('inet','json','url','uuid','xml') THEN ").append(Types.JAVA_OBJECT) 3390 "cast(CASE WHEN t.\"sqlname\" = 'xml' THEN ").append(Types.JAVA_OBJECT)
3396 .append(" ELSE ").append(Types.STRUCT).append(" END AS int) AS \"DATA_TYPE\", " + 3391 .append(" ELSE ").append(Types.STRUCT).append(" END AS int) AS \"DATA_TYPE\", " +
3397 "t.\"systemname\" AS \"REMARKS\", " + 3392 "t.\"systemname\" AS \"REMARKS\", " +
3398 "cast(null as smallint) AS \"BASE_TYPE\" " + 3393 "cast(null as smallint) AS \"BASE_TYPE\" " +
3399 "FROM \"sys\".\"types\" t " + 3394 "FROM \"sys\".\"types\" t " +
3400 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " + 3395 "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = s.\"id\" " +
3401 // exclude the built-in types (I assume they always have id <= 99 and eclass < 15) 3396 // exclude the built-in types (I assume they always have id <= 99 and eclass < 18)
3402 "WHERE t.\"id\" > 99 AND t.\"eclass\" >= 15"); 3397 "WHERE t.\"id\" > 99" +
3398 " AND t.\"eclass\" >= 18" +
3399 " AND t.\"sqlname\" NOT IN ('inet','json','url','uuid')");
3403 3400
3404 if (catalog != null && !catalog.isEmpty()) { 3401 if (catalog != null && !catalog.isEmpty()) {
3405 // non-empty catalog selection. 3402 // non-empty catalog selection.
3406 // as we do not support catalogs this always results in no rows returned 3403 // as we do not support catalogs this always results in no rows returned
3407 query.append(" AND 1=0"); 3404 query.append(" AND 1=0");