Mercurial > hg > monetdb-java
changeset 757:7f68120de37c
Corrected DatabaseMetaData method getClientProperties().
It used to return connection properties instead of client info properties.
Extended tests.
HG En commit message. Lines beginning with 'HG:' are removed.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 22 Jun 2023 14:54:03 +0200 (21 months ago) |
parents | a39d3a45da56 |
children | 37eae5a78c1b |
files | ChangeLog src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java tests/JDBC_API_Tester.java |
diffstat | 3 files changed, 40 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog file for monetdb-java # This file is updated with Maddlog +* Thu Jun 22 2023 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> +- Corrected DatabaseMetaData method getClientProperties(). + It used to return connection properties instead of client info properties. + * Thu May 4 2023 Martin van Dinther <martin.van.dinther@monetdbsolutions.com> - Corrected DatabaseMetaData method getStringFunctions() when connected to Jun2023 server. It now includes the string functions from the new
--- a/src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java +++ b/src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java @@ -3911,25 +3911,13 @@ public final class MonetDatabaseMetaData */ @Override public ResultSet getClientInfoProperties() throws SQLException { - // for a list of connection properties see also MonetConnection.java constructor MonetConnection(Properties props) + // MonetDB currently does not support any client properties, so return an empty ResultSet final String query = - "SELECT * FROM (VALUES " + - "('autocommit', cast(5 as int), 'true', 'boolean flag true or false to turn autocommit on or off')," + - "('database', 1024, 'demo', 'name of database. It matches the dbfarm subdirectory name')," + - "('debug', 5, 'false', 'boolean flag true or false to turn debug logging on or off')," + - "('fetchsize', 11, '250', 'number of result rows to fetch per round trip')," + // only supported by servers from version 11.41.1 onwards - "('hash', 128, '', 'hash methods list to use in server connection. Supported are SHA512, SHA384, SHA256 and SHA1')," + - "('host', 1024, 'localhost', 'DSN or IP-address of machine running MonetDB')," + - "('language', 16, 'sql', 'language (sql or mal) used to parse commands in MonetDB server')," + - "('logfile', 1024, 'monet_######.log', 'name of logfile used when debug is enabled')," + - "('password', 128, '', 'password for user name to login to MonetDB server')," + - "('port', 5, '50000', 'communication port number of MonetDB server process')," + - "('so_timeout', 10, '0', 'timeout (in milliseconds) of communication socket. 0 means no timeout is set')," + - "('treat_blob_as_binary', 5, 'true', 'should blob columns be mapped to Types.VARBINARY instead of Types.BLOB in ResultSets and PreparedStatements')," + - "('treat_clob_as_varchar', 5, 'true', 'should clob columns be mapped to Types.VARCHAR instead of Types.CLOB in ResultSets and PreparedStatements')," + - "('user', 1024, '', 'user name to login to MonetDB server')" + - ") AS t(\"NAME\", \"MAX_LEN\", \"DEFAULT_VALUE\", \"DESCRIPTION\")" + - " ORDER BY \"NAME\""; + "SELECT cast(null as varchar(64)) AS \"NAME\", " + + "cast(0 as int) AS \"MAX_LEN\", " + + "cast(null as varchar(128)) AS \"DEFAULT_VALUE\", " + + "cast(null as varchar(128)) AS \"DESCRIPTION\" " + + "WHERE 1=0"; return executeMetaDataQuery(query); }
--- a/tests/JDBC_API_Tester.java +++ b/tests/JDBC_API_Tester.java @@ -1344,6 +1344,36 @@ final public class JDBC_API_Tester { "TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME GRANTOR GRANTEE PRIVILEGE IS_GRANTABLE\n" + "char(1) varchar(1024) varchar(1024) varchar(1024) varchar(1024) varchar(1024) varchar(40) varchar(3)\n"); + compareResultSet(dbmd.getClientInfoProperties(), "getClientInfoProperties()", + "Resultset with 4 columns\n" + + "NAME MAX_LEN DEFAULT_VALUE DESCRIPTION\n" + + "varchar(64) int varchar(128) varchar(128)\n"); + + compareResultSet(dbmd.getSuperTables(null, "jdbctst", "pk_uc"), "getSuperTypes(null, jdbctst, pk_uc)", + "Resultset with 4 columns\n" + + "TABLE_CAT TABLE_SCHEM TABLE_NAME SUPERTABLE_NAME\n" + + "char(1) char char char\n"); + + compareResultSet(dbmd.getPseudoColumns(null, "jdbctst", "pk_uc", "%"), "getPseudoColumns(null, jdbctst, pk_uc, %)", + "Resultset with 12 columns\n" + + "TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE COLUMN_SIZE DECIMAL_DIGITS NUM_PREC_RADIX COLUMN_USAGE REMARKS CHAR_OCTET_LENGTH IS_NULLABLE\n" + + "char(1) char char char int int int int char char int char\n"); + + compareResultSet(dbmd.getVersionColumns(null, "jdbctst", "pk_uc"), "getVersionColumns(null, jdbctst, pk_uc)", + "Resultset with 8 columns\n" + + "SCOPE COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE BUFFER_LENGTH DECIMAL_DIGITS PSEUDO_COLUMN\n" + + "smallint char(1) int char(1) int int smallint smallint\n"); + + compareResultSet(dbmd.getSuperTypes(null, "sys", "xml"), "getSuperTypes(null, sys, xml)", + "Resultset with 6 columns\n" + + "TYPE_CAT TYPE_SCHEM TYPE_NAME SUPERTYPE_CAT SUPERTYPE_SCHEM SUPERTYPE_NAME\n" + + "char(1) char char char(1) char char\n"); + + compareResultSet(dbmd.getAttributes(null, "sys", "xml", "%"), "getAttributes(null, sys, xml, %)", + "Resultset with 21 columns\n" + + "TYPE_CAT TYPE_SCHEM TYPE_NAME ATTR_NAME DATA_TYPE ATTR_TYPE_NAME ATTR_SIZE DECIMAL_DIGITS NUM_PREC_RADIX NULLABLE REMARKS ATTR_DEF SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE SCOPE_CATALOG SCOPE_SCHEMA SCOPE_TABLE SOURCE_DATA_TYPE\n" + + "char(1) char char char int char int int int int char char int int int int char(3) char char char smallint\n"); + sb.setLength(0); // clear the output log buffer } catch (SQLException e) { sb.setLength(0); // clear the output log buffer