class RelationalTableRegistrationHelper {

    public List<SchemaColumn> getSchemaColumns(final ResultSet resultSet) throws SQLException
    {
        // Create an empty schema columns list.
        List<SchemaColumn> schemaColumns = new ArrayList<>();

        // While there are further results in the result set create a new schema column and add it to the list.
        while (resultSet.next())
        {
            SchemaColumn schemaColumn = new SchemaColumn();
            schemaColumn.setName(resultSet.getString("COLUMN_NAME"));
            schemaColumn.setType(resultSet.getString("TYPE_NAME"));

            // If this is a numeric column then include the decimal digits as part of the size.
            if (resultSet.getString("TYPE_NAME").equalsIgnoreCase("NUMERIC")
                && StringUtils.isNotEmpty(resultSet.getString("DECIMAL_DIGITS")))
            {
                schemaColumn.setSize(resultSet.getString("COLUMN_SIZE") + "," + resultSet.getString("DECIMAL_DIGITS"));
            }
            else
            {
                schemaColumn.setSize(resultSet.getString("COLUMN_SIZE"));
            }

            schemaColumn.setRequired(resultSet.getInt("NULLABLE") == 0);
            schemaColumn.setDefaultValue(resultSet.getString("COLUMN_DEF"));
            schemaColumns.add(schemaColumn);
        }

        return schemaColumns;
    }

}