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 2019/11/13 08:35:20 UTC

[GitHub] [incubator-shardingsphere] huangmingsir commented on issue #3503: dataencrypt feature with “java.sql.SQLDataException: Cannot determine value type from string 'NO'”

huangmingsir commented on issue #3503: dataencrypt feature with “java.sql.SQLDataException: Cannot determine value type from string 'NO'”
URL: https://github.com/apache/incubator-shardingsphere/issues/3503#issuecomment-553296021
 
 
   There are two notable code in the 4.0.0-RC3.
   EncryptRuntimeContext.getColumnMetaDataList()
   TableMetaDataLoader.getColumnMetaDataList
   
   I suggest changing it like bellow.
   
   `ResultSetMetaData metaData = resultSet.getMetaData();
               while (resultSet.next()) {
                   String columnName = resultSet.getString(COLUMN_NAME);
                   String columnType = resultSet.getString(TYPE_NAME);
                   boolean isPrimaryKey = primaryKeys.contains(columnName);
                   int findColumn = resultSet.findColumn(IS_AUTOINCREMENT);
                   boolean isAutoIncrement = metaData.isAutoIncrement(findColumn);
                   int nullable = resultSet.getInt("NULLABLE");
                   boolean isNotNull = isPrimaryKey || nullable == 0 ? true : false;
                   Optional<ColumnMetaData> columnMetaData = getColumnMetaData(tableName, columnName, columnType, isPrimaryKey, isNotNull, isAutoIncrement, encryptRule, derivedColumns);
                   if (columnMetaData.isPresent()) {
                       result.add(columnMetaData.get());
                   }
               }`

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


With regards,
Apache Git Services