You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Jin Kwon (JIRA)" <ji...@apache.org> on 2015/11/05 07:26:27 UTC

[jira] [Comment Edited] (DERBY-6840) DatabaseMetaData.getBestRowIdentifier/DECIMAL_DIGITS' type is Integer

    [ https://issues.apache.org/jira/browse/DERBY-6840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14991220#comment-14991220 ] 

Jin Kwon edited comment on DERBY-6840 at 11/5/15 6:26 AM:
----------------------------------------------------------

In B.3 JDBC Types Mapped to Java Object Types, there is an explicit note saying
{quote}
The mapping of SMALLINT and TINYINT to Integer is maintained to preserve backwards compatibility.
{quote}

And the B.3 is for local java type for those {{getXXX}} methods which applies when database type is {{SMALLINT}} we can get it for {{int}} type.

Let's walk the path again.

 # {{DatabaseMetaData#getBestRowIdentifier/DECIMAL_DIGITS}} should return a {{short}} value which can't be {{null}}.
 # You mentioned {{SMALLINT}}, B.2 which is for {{setXXX}}
 # You mentioned {{Integer}}, B.3 which is for {{getXXX}} and for backward compatibility

The problem is that you presumed a backend physical column type, whatever it exists or not, as {{SMALLINT}}.

I believe {{getBestRowIdentifier/DECIMAL_DIGITS}} should be available by
````
resultSet.getShort("DECIMAL_DIGITS");
resultSet.getObject("DECIMAL_DIGITS", Short.class);
````


was (Author: jinahya):
In B.3 JDBC Types Mapped to Java Object Types, there is an explicit note saying
{quote}
The mapping of SMALLINT and TINYINT to Integer is maintained to preserve backwards compatibility.
{quote}

And the B.3 is for local java type for those {{getXXX}} methods which applies when database type is {{{SMALLINT}}} we can get it for {{{int}}} type.

Let's walk the path again.

# {{{DatabaseMetaData#getBestRowIdentifier/DECIMAL_DIGITS}}} should return a {{{short}}} value which can't be {{{null}}}.
# You mentioned {{{SMALLINT}}}, B.2 which is for {{{setXXX}}}
# You mentioned {{{Integer}}}, B.3 which is for {{{getXXX}}} and for backward compatibility

The problem is that you presumed a backend physical column type, whatever it exists or not, as {{{SMALLINT}}}.

I believe {{{getBestRowIdentifier/DECIMAL_DIGITS}}} should be available by
````
resultSet.getShort("DECIMAL_DIGITS");
resultSet.getObject("DECIMAL_DIGITS", Short.class);
````

> DatabaseMetaData.getBestRowIdentifier/DECIMAL_DIGITS' type is Integer
> ---------------------------------------------------------------------
>
>                 Key: DERBY-6840
>                 URL: https://issues.apache.org/jira/browse/DERBY-6840
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.12.1.1
>            Reporter: Jin Kwon
>            Priority: Trivial
>
> The value of {{DECIMAL_DIGITS}} of {{DatabaseMetaData.getBestRowIdentifier}} is an {{java.lang.Integer}} not {{java.lang.Short}}. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)