protected void calculatePrimaryKey(DatabaseConfig config,
                                       IntrospectedTable introspectedTable) {
        ResultSet rs = null;
        try {
            rs = dbMetadataUtils.getDatabaseMetaData().getPrimaryKeys(
                    config.getCatalog(),
                    config.getSchemaPattern(),
                    introspectedTable.getName());
        } catch (SQLException e) {
            closeResultSet(rs);
            return;
        }

        try {
            Map<Short, String> keyColumns = new TreeMap<Short, String>();
            while (rs.next()) {
                //主键列名
                String columnName = rs.getString("COLUMN_NAME");
                //主键顺序
                short keySeq = rs.getShort("KEY_SEQ");
                keyColumns.put(keySeq, columnName);
            }

            for (String columnName : keyColumns.values()) {
                introspectedTable.addPrimaryKeyColumn(columnName);
            }
        } catch (SQLException e) {
        } finally {
            closeResultSet(rs);
        }
    }
protected void calculatePrimaryKey(DatabaseConfig config,
                                       IntrospectedTable introspectedTable) {
        ResultSet rs = null;
        try {
            rs = dbMetadataUtils.getDatabaseMetaData().getPrimaryKeys(
                    config.getCatalog(),
                    config.getSchemaPattern(),
                    introspectedTable.getName());
        } catch (SQLException e) {
            closeResultSet(rs);
            return;
        }

        try {
            Map<Short, String> keyColumns = new TreeMap<Short, String>();
            while (rs.next()) {
                
                String columnName = rs.getString("COLUMN_NAME");
                
                short keySeq = rs.getShort("KEY_SEQ");
                keyColumns.put(keySeq, columnName);
            }

            for (String columnName : keyColumns.values()) {
                introspectedTable.addPrimaryKeyColumn(columnName);
            }
        } catch (SQLException e) {
        } finally {
            closeResultSet(rs);
        }
    }
protected void calculatePrimaryKey ( DatabaseConfig config , IntrospectedTable introspectedTable ) { ResultSet rs = null ; try { rs = dbMetadataUtils . getDatabaseMetaData ( ) . getPrimaryKeys ( config . getCatalog ( ) , config . getSchemaPattern ( ) , introspectedTable . getName ( ) ) ; } catch ( SQLException e ) { closeResultSet ( rs ) ; return ; } try { Map < Short , String > keyColumns = new TreeMap < Short , String > ( ) ; while ( rs . next ( ) ) { //主键列名 String columnName = rs . getString ( "COLUMN_NAME" ) ; //主键顺序 short keySeq = rs . getShort ( "KEY_SEQ" ) ; keyColumns . put ( keySeq , columnName ) ; } for ( String columnName : keyColumns . values ( ) ) { introspectedTable . addPrimaryKeyColumn ( columnName ) ; } } catch ( SQLException e ) { } finally { closeResultSet ( rs ) ; } }
计算主键

@param config
@param introspectedTable
计算主键