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

feat: improve ResultSet#getObject(int, Class) #932

Merged
merged 1 commit into from Sep 26, 2017

Conversation

@marschall
Copy link
Contributor

@marschall marschall commented Sep 3, 2017

In the review of #813 various issues with the initial implementation of
CallableStatement#getObject(int, Class) showed up that
ResultSet#getObject(int, Class) also has. This commit gives both
methods the same behavior.

This commit contains the following changes

  • make errors localizable
  • add support for SMALLINT <-> Short
  • add support for BIGINT <-> BigInteger
  • add support for TIMESTAMP <-> java.util.Date
  • swap INTEGER and SMALLINT position
@marschall marschall force-pushed the marschall:update-resultset-getobject branch from 0ad8ac6 to bd53fed Sep 3, 2017
@codecov-io
Copy link

@codecov-io codecov-io commented Sep 3, 2017

Codecov Report

Merging #932 into master will increase coverage by 0.02%.
The diff coverage is 27.5%.

@@             Coverage Diff             @@
##             master    #932      +/-   ##
===========================================
+ Coverage     65.88%   65.9%   +0.02%     
- Complexity     3556    3560       +4     
===========================================
  Files           166     166              
  Lines         15223   15238      +15     
  Branches       2458    2464       +6     
===========================================
+ Hits          10030   10043      +13     
+ Misses         4024    4023       -1     
- Partials       1169    1172       +3
@marschall marschall force-pushed the marschall:update-resultset-getobject branch from bd53fed to 7c73c07 Sep 3, 2017
@@ -3166,13 +3166,15 @@ public void updateArray(String columnName, Array x) throws SQLException {
if (sqlType == Types.NUMERIC || sqlType == Types.DECIMAL) {
return type.cast(getBigDecimal(columnIndex));
} else {
throw new SQLException("conversion to " + type + " from " + sqlType + " not supported");
throw new PSQLException(GT.tr("Unsupported type conversion to {1}.", type),

This comment has been minimized.

@vlsi

vlsi Sep 25, 2017
Member

@marschall , would you please keep " from " + sqlType in the error message?

This comment has been minimized.

@marschall

marschall Sep 25, 2017
Author Contributor

done

@marschall marschall force-pushed the marschall:update-resultset-getobject branch from 7c73c07 to 7b3b0e2 Sep 25, 2017
@@ -3166,13 +3166,15 @@ public void updateArray(String columnName, Array x) throws SQLException {
if (sqlType == Types.NUMERIC || sqlType == Types.DECIMAL) {
return type.cast(getBigDecimal(columnIndex));
} else {
throw new SQLException("conversion to " + type + " from " + sqlType + " not supported");
throw new PSQLException(GT.tr("conversion to {1} from {2} not supported", type, sqlType),

This comment has been minimized.

@vlsi

vlsi Sep 25, 2017
Member

Are you sure placeholders are 1-based?
We use MessageFormat (

message = MessageFormat.format(message, args);
), and it is 0-based (see https://docs.oracle.com/javase/7/docs/api/java/text/MessageFormat.html )

This comment has been minimized.

In the review of #813 various issues with the initial implementation of
CallableStatement#getObject(int, Class) showed up that
ResultSet#getObject(int, Class) also has. This commit gives both
methods the same behavior.

This commit contains the following changes

- make errors localizable
- add support for SMALLINT <-> Short
- add support for BIGINT <-> BigInteger
- add support for TIMESTAMP <-> java.util.Date
- swap INTEGER and SMALLINT position
@marschall marschall force-pushed the marschall:update-resultset-getobject branch from 7b3b0e2 to 381aa85 Sep 25, 2017
@vlsi vlsi added this to the 42.1.5 milestone Sep 26, 2017
@vlsi
vlsi approved these changes Sep 26, 2017
@vlsi vlsi merged commit fcb28c7 into pgjdbc:master Sep 26, 2017
2 checks passed
2 checks passed
codecov/project 65.9% (+0.02%) compared to ee6443d
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@vlsi vlsi modified the milestones: 42.1.5, 42.2.0 Jan 8, 2018
rhavermans added a commit to bolcom/pgjdbc that referenced this pull request Jul 13, 2018
In the review of pgjdbc#813 various issues with the initial implementation of
CallableStatement#getObject(int, Class) showed up that
ResultSet#getObject(int, Class) also has. This commit gives both
methods the same behavior.

This commit contains the following changes

- make errors localizable
- add support for SMALLINT <-> Short
- add support for BIGINT <-> BigInteger
- add support for TIMESTAMP <-> java.util.Date
- swap INTEGER and SMALLINT position
rhavermans added a commit to bolcom/pgjdbc that referenced this pull request Jul 13, 2018
In the review of pgjdbc#813 various issues with the initial implementation of
CallableStatement#getObject(int, Class) showed up that
ResultSet#getObject(int, Class) also has. This commit gives both
methods the same behavior.

This commit contains the following changes

- make errors localizable
- add support for SMALLINT <-> Short
- add support for BIGINT <-> BigInteger
- add support for TIMESTAMP <-> java.util.Date
- swap INTEGER and SMALLINT position
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants