Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incomplete implementation of JDBC driver supportsConvert(), supportsConvert(int fromType, int toType) methods in MonetDatabaseMetaData.java #3460

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2014-03-28 14:55:32 +0100
From: Martin van Dinther <<martin.van.dinther>>
To: clients devs <>
Version: 11.21.19 (Jul2015-SP4)

Last updated: 2016-08-04 18:27:25 +0200

Comment 19713

Date: 2014-03-28 14:55:32 +0100
From: Martin van Dinther <<martin.van.dinther>>

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0
Build Identifier:

In java/src/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java the methods supportsConvert(), supportsConvert(int fromType, int toType) are NOT correctly implemented. They both return false which not correct.

In ODBC driver code (clients/odbc/driver/SQLGetInfo.c) these are implemented see: SQLGetInfo() for:
case SQL_CONVERT_BIGINT:
case SQL_CONVERT_BINARY:
case SQL_CONVERT_BIT:
case SQL_CONVERT_CHAR:
case SQL_CONVERT_DATE:
case SQL_CONVERT_DECIMAL:
case SQL_CONVERT_DOUBLE:
case SQL_CONVERT_FLOAT:
case SQL_CONVERT_INTEGER:
case SQL_CONVERT_INTERVAL_DAY_TIME:
case SQL_CONVERT_INTERVAL_YEAR_MONTH:
case SQL_CONVERT_LONGVARBINARY:
case SQL_CONVERT_LONGVARCHAR:
case SQL_CONVERT_NUMERIC:
case SQL_CONVERT_REAL:
case SQL_CONVERT_SMALLINT:
case SQL_CONVERT_TIME:
case SQL_CONVERT_TIMESTAMP:
case SQL_CONVERT_TINYINT:
case SQL_CONVERT_VARBINARY:
case SQL_CONVERT_VARCHAR:
nValue = SQL_CVT_BIGINT |
SQL_CVT_BINARY |
SQL_CVT_BIT |
SQL_CVT_CHAR |
SQL_CVT_DATE |
SQL_CVT_DECIMAL |
SQL_CVT_DOUBLE |
SQL_CVT_FLOAT |
SQL_CVT_INTEGER |
SQL_CVT_INTERVAL_DAY_TIME |
SQL_CVT_INTERVAL_YEAR_MONTH |
SQL_CVT_LONGVARBINARY |
SQL_CVT_LONGVARCHAR |
SQL_CVT_NUMERIC |
SQL_CVT_REAL |
SQL_CVT_SMALLINT |
SQL_CVT_TIME |
SQL_CVT_TIMESTAMP |
SQL_CVT_TINYINT |
SQL_CVT_VARBINARY |
SQL_CVT_VARCHAR;
len = sizeof(SQLUINTEGER);
break;
case SQL_CONVERT_FUNCTIONS:
nValue = SQL_FN_CVT_CAST | SQL_FN_CVT_CONVERT;
len = sizeof(SQLUINTEGER);
break;

MonetDatabaseMetaData.java needs to be updated for the mentioned methods.

Reproducible: Always

Steps to Reproduce:

  1. start mserver5
  2. start SQuirreL connecting to demo database
  3. in Objects panel, select tab Metadata, search for property "supportsConvert". it shows value: false

Actual Results:

both methods return false

Expected Results:

method supportsConvert() should return true.
method supportsConvert(int fromType, int toType) should return true or false depending on the combination of fromType and toType.

SQL query which uses convert function:
SELECT DISTINCT type, convert(type, char(6)) as type_str, convert(type, double) as type_dbl, sql, convert(sql, int) as sql_int, convert(sql, char(5)) as sql_str
FROM SYS.FUNCTIONS

SQL query which uses cast function:
SELECT DISTINCT type, cast(type as char(5)) as type_str, cast(type as double) as type_dbl, sql, cast(sql as int) as sql_int, cast(sql as char(5)) as sql_str
FROM SYS.FUNCTIONS

Both SQL queries are accepted by MonetDB and produce output:
type type_str type_dbl sql sql_int sql_str
1 1 1 false 0 0
3 3 3 false 0 0
1 1 1 true 1 1
4 4 4 true 1 1
2 2 2 true 1 1
3 3 3 true 1 1

Comment 22157

Date: 2016-05-19 19:28:38 +0200
From: MonetDB Mercurial Repository <>

Changeset 67d578e84e0b made by Martin van Dinther martin.van.dinther@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=67d578e84e0b

Changeset description:

Implemented MonetDatabaseMetaData.supportsConvert() and
MonetDatabaseMetaData.supportsConvert(int fromType, int toType) methods.
It used to always return false. Now it returns true for the supported conversions.
This fixes Bug #3460.

Comment 22248

Date: 2016-07-14 17:44:46 +0200
From: MonetDB Mercurial Repository <>

Changeset 76af7753bd2e made by Martin van Dinther martin.van.dinther@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=76af7753bd2e

Changeset description:

Test script to test scalar functions convert(fromType, toType) and cast(fromType as toType)
 for most MonetDB SQL data types and data values
See also Bug #3460.

Comment 22282

Date: 2016-08-04 18:27:25 +0200
From: MonetDB Mercurial Repository <>

Changeset 517709436cea made by Martin van Dinther martin.van.dinther@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=517709436cea

Changeset description:

Run convert-function-test.Bug-3460 serial (1 thread) to get stable output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant