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

Projects
None yet
3 participants
@marschall
Contributor

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
@codecov-io

This comment has been minimized.

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
@@ -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

Contributor

done

@@ -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.

@marschall
feat: improve ResultSet#getObject(int, Class)
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

@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

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

feat: improve ResultSet#getObject(int, Class) (pgjdbc#932)
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

feat: improve ResultSet#getObject(int, Class) (pgjdbc#932)
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