mirror of
				https://github.com/vran-dev/databasir.git
				synced 2025-11-04 16:26:10 +08:00 
			
		
		
		
	fix: hive sync error (#135)
This commit is contained in:
		@@ -52,10 +52,7 @@ public class JdbcColumnMetaRepository implements ColumnMetaRepository {
 | 
			
		||||
                    if (isNullable.trim().equals("")) {
 | 
			
		||||
                        isNullable = "UNKNOWN";
 | 
			
		||||
                    }
 | 
			
		||||
                    String isAutoIncrement = columnsResult.getString("IS_AUTOINCREMENT");
 | 
			
		||||
                    if (isAutoIncrement.trim().equals("")) {
 | 
			
		||||
                        isAutoIncrement = "UNKNOWN";
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (defaultValue != null && defaultValue.trim().equals("")) {
 | 
			
		||||
                        defaultValue = "'" + defaultValue + "'";
 | 
			
		||||
                    }
 | 
			
		||||
@@ -76,7 +73,7 @@ public class JdbcColumnMetaRepository implements ColumnMetaRepository {
 | 
			
		||||
                            .size(columnSize)
 | 
			
		||||
                            .decimalDigits(decimalDigits)
 | 
			
		||||
                            .nullable(isNullable)
 | 
			
		||||
                            .autoIncrement(isAutoIncrement)
 | 
			
		||||
                            .autoIncrement(retrieveAutoIncrement(columnsResult))
 | 
			
		||||
                            .comment(columnComment)
 | 
			
		||||
                            .defaultValue(defaultValue)
 | 
			
		||||
                            .isPrimaryKey(primaryKeyColumns.contains(columnName))
 | 
			
		||||
@@ -90,6 +87,20 @@ public class JdbcColumnMetaRepository implements ColumnMetaRepository {
 | 
			
		||||
        return columnDocs;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String retrieveAutoIncrement(ResultSet columnsResult) {
 | 
			
		||||
        String isAutoIncrement = null;
 | 
			
		||||
        try {
 | 
			
		||||
            isAutoIncrement = columnsResult.getString("IS_AUTOINCREMENT");
 | 
			
		||||
            if (isAutoIncrement.trim().equals("")) {
 | 
			
		||||
                isAutoIncrement = "UNKNOWN";
 | 
			
		||||
            }
 | 
			
		||||
            return isAutoIncrement;
 | 
			
		||||
        } catch (SQLException e) {
 | 
			
		||||
            log.warn("warn: ignore auto increment, error: " + e.getMessage());
 | 
			
		||||
            return "UNKNOWN";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private List<String> selectPrimaryKeyColumns(DatabaseMetaData meta,
 | 
			
		||||
                                                 TableCondition tableCondition) throws SQLException {
 | 
			
		||||
        ResultSet result = meta.getPrimaryKeys(tableCondition.getDatabaseName(),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user