You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/02/18 04:32:50 UTC

[GitHub] [shardingsphere] RaigorJiang opened a new pull request #15487: Fixes #15083, support more types in `getObject` method.

RaigorJiang opened a new pull request #15487:
URL: https://github.com/apache/shardingsphere/pull/15487


   Fixes #15083.
   
   ## Referemce
   ### MySQL
   - mysql-connector-java:8.0
   https://github.com/mysql/mysql-connector-j/blob/release/8.0/src/main/user-impl/java/com/mysql/cj/jdbc/result/ResultSetImpl.java
   
   - mysql-connector-java:5.1
   https://github.com/mysql/mysql-connector-j/blob/release/5.1/src/com/mysql/jdbc/ResultSetImpl.java
   
   ### Postgres
   https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu merged pull request #15487: Fixes #15083, support more types in `getObject` method.

Posted by GitBox <gi...@apache.org>.
strongduanmu merged pull request #15487:
URL: https://github.com/apache/shardingsphere/pull/15487


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #15487: Fixes #15083, support more types in `getObject` method.

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #15487:
URL: https://github.com/apache/shardingsphere/pull/15487#discussion_r809694820



##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSet.java
##########
@@ -367,8 +369,47 @@ public Object getObject(final String columnLabel) throws SQLException {
     @SuppressWarnings("unchecked")
     @Override
     public <T> T getObject(final int columnIndex, final Class<T> type) throws SQLException {
-        if (LocalDateTime.class.equals(type) || LocalDate.class.equals(type) || LocalTime.class.equals(type)) {
+        if (null == type) {
+            throw new SQLException("Type cannot be null");
+        }
+        if (String.class.equals(type)) {

Review comment:
       @RaigorJiang Can we move this logic to ResultSetUtil#convertValue, it seems to be the utility class responsible for type conversion.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on pull request #15487: Fixes #15083, support more types in `getObject` method.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on pull request #15487:
URL: https://github.com/apache/shardingsphere/pull/15487#issuecomment-1045453318


   @strongduanmu 
   Thanks for your review 🤠


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] RaigorJiang commented on a change in pull request #15487: Fixes #15083, support more types in `getObject` method.

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on a change in pull request #15487:
URL: https://github.com/apache/shardingsphere/pull/15487#discussion_r809703365



##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSet.java
##########
@@ -367,8 +369,47 @@ public Object getObject(final String columnLabel) throws SQLException {
     @SuppressWarnings("unchecked")
     @Override
     public <T> T getObject(final int columnIndex, final Class<T> type) throws SQLException {
-        if (LocalDateTime.class.equals(type) || LocalDate.class.equals(type) || LocalTime.class.equals(type)) {
+        if (null == type) {
+            throw new SQLException("Type cannot be null");
+        }
+        if (String.class.equals(type)) {

Review comment:
       Sure, I will move it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org