protected Map<IntrospectedTable, List<IntrospectedColumn>> getColumns(DatabaseConfig config) throws SQLException {
        Map<IntrospectedTable, List<IntrospectedColumn>> answer = new HashMap<IntrospectedTable, List<IntrospectedColumn>>();

        ResultSet rs = dbMetadataUtils.getDatabaseMetaData().getColumns(
                config.getCatalog(),
                config.getSchemaPattern(),
                config.getTableNamePattern(),
                null);
        while (rs.next()) {
            IntrospectedColumn column = new IntrospectedColumn();
            column.setJdbcType(rs.getInt("DATA_TYPE"));
            column.setType(rs.getString("TYPE_NAME"));
            column.setLength(rs.getInt("COLUMN_SIZE"));
            column.setName(rs.getString("COLUMN_NAME"));
            column.setNullable(rs.getInt("NULLABLE") == DatabaseMetaData.columnNullable);
            column.setScale(rs.getInt("DECIMAL_DIGITS"));
            column.setRemarks(rs.getString("REMARKS"));
            column.setDefaultValue(rs.getString("COLUMN_DEF"));

            IntrospectedTable table = new IntrospectedTable(
                    rs.getString("TABLE_CAT"),
                    rs.getString("TABLE_SCHEM"),
                    rs.getString("TABLE_NAME"));

            List<IntrospectedColumn> columns = answer.get(table);
            if (columns == null) {
                columns = new ArrayList<IntrospectedColumn>();
                answer.put(table, columns);
                if (config.hasProcess()) {
                    config.getDatabaseProcess().processTable(table);
                }
            }
            if (config.hasProcess()) {
                config.getDatabaseProcess().processColumn(table, column);
            }
            columns.add(column);
        }
        closeResultSet(rs);
        return answer;
    }
protected Map<IntrospectedTable, List<IntrospectedColumn>> getColumns(DatabaseConfig config) throws SQLException {
        Map<IntrospectedTable, List<IntrospectedColumn>> answer = new HashMap<IntrospectedTable, List<IntrospectedColumn>>();

        ResultSet rs = dbMetadataUtils.getDatabaseMetaData().getColumns(
                config.getCatalog(),
                config.getSchemaPattern(),
                config.getTableNamePattern(),
                null);
        while (rs.next()) {
            IntrospectedColumn column = new IntrospectedColumn();
            column.setJdbcType(rs.getInt("DATA_TYPE"));
            column.setType(rs.getString("TYPE_NAME"));
            column.setLength(rs.getInt("COLUMN_SIZE"));
            column.setName(rs.getString("COLUMN_NAME"));
            column.setNullable(rs.getInt("NULLABLE") == DatabaseMetaData.columnNullable);
            column.setScale(rs.getInt("DECIMAL_DIGITS"));
            column.setRemarks(rs.getString("REMARKS"));
            column.setDefaultValue(rs.getString("COLUMN_DEF"));

            IntrospectedTable table = new IntrospectedTable(
                    rs.getString("TABLE_CAT"),
                    rs.getString("TABLE_SCHEM"),
                    rs.getString("TABLE_NAME"));

            List<IntrospectedColumn> columns = answer.get(table);
            if (columns == null) {
                columns = new ArrayList<IntrospectedColumn>();
                answer.put(table, columns);
                if (config.hasProcess()) {
                    config.getDatabaseProcess().processTable(table);
                }
            }
            if (config.hasProcess()) {
                config.getDatabaseProcess().processColumn(table, column);
            }
            columns.add(column);
        }
        closeResultSet(rs);
        return answer;
    }
protected Map < IntrospectedTable , List < IntrospectedColumn > > getColumns ( DatabaseConfig config ) throws SQLException { Map < IntrospectedTable , List < IntrospectedColumn > > answer = new HashMap < IntrospectedTable , List < IntrospectedColumn > > ( ) ; ResultSet rs = dbMetadataUtils . getDatabaseMetaData ( ) . getColumns ( config . getCatalog ( ) , config . getSchemaPattern ( ) , config . getTableNamePattern ( ) , null ) ; while ( rs . next ( ) ) { IntrospectedColumn column = new IntrospectedColumn ( ) ; column . setJdbcType ( rs . getInt ( "DATA_TYPE" ) ) ; column . setType ( rs . getString ( "TYPE_NAME" ) ) ; column . setLength ( rs . getInt ( "COLUMN_SIZE" ) ) ; column . setName ( rs . getString ( "COLUMN_NAME" ) ) ; column . setNullable ( rs . getInt ( "NULLABLE" ) == DatabaseMetaData . columnNullable ) ; column . setScale ( rs . getInt ( "DECIMAL_DIGITS" ) ) ; column . setRemarks ( rs . getString ( "REMARKS" ) ) ; column . setDefaultValue ( rs . getString ( "COLUMN_DEF" ) ) ; IntrospectedTable table = new IntrospectedTable ( rs . getString ( "TABLE_CAT" ) , rs . getString ( "TABLE_SCHEM" ) , rs . getString ( "TABLE_NAME" ) ) ; List < IntrospectedColumn > columns = answer . get ( table ) ; if ( columns == null ) { columns = new ArrayList < IntrospectedColumn > ( ) ; answer . put ( table , columns ) ; if ( config . hasProcess ( ) ) { config . getDatabaseProcess ( ) . processTable ( table ) ; } } if ( config . hasProcess ( ) ) { config . getDatabaseProcess ( ) . processColumn ( table , column ) ; } columns . add ( column ) ; } closeResultSet ( rs ) ; return answer ; }
获取全部的表和字段

@param config
@return
@throws SQLException
获取全部的表和字段