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 2020/06/10 08:13:30 UTC

[GitHub] [shardingsphere] Lucas-307 commented on a change in pull request #5976: Fix: fix the type transfer issue (#5957)

Lucas-307 commented on a change in pull request #5976:
URL: https://github.com/apache/shardingsphere/pull/5976#discussion_r437941795



##########
File path: shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/importer/AbstractJDBCImporter.java
##########
@@ -123,12 +126,24 @@ private void executeInsert(final Connection connection, final DataRecord record)
         ps.setQueryTimeout(30);
         try {
             for (int i = 0; i < record.getColumnCount(); i++) {
-                ps.setObject(i + 1, record.getColumn(i).getValue());
+                SQLType sqlType = extractTargetSQLType(record.getColumn(i).getValue());
+                if (sqlType != null) {
+                    ps.setObject(i + 1, record.getColumn(i).getValue(), sqlType);
+                } else {
+                    ps.setObject(i + 1, record.getColumn(i).getValue());
+                }
             }
             ps.execute();
         } catch (SQLIntegrityConstraintViolationException ignored) {
         }
     }
+
+    private SQLType extractTargetSQLType(final Object recordValue) {
+        if (recordValue instanceof BigInteger) {
+            return JDBCType.BIGINT;
+        }
+        return null;
+    }

Review comment:
       Only process Bigint is not eough, we'd better cover all type.




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

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