/** * Retrieves additional column attributes from the database. * * @throws SQLException On a SQL exception */ void retrieveAdditionalColumnAttributes() throws SQLException { final InformationSchemaViews informationSchemaViews = getRetrieverConnection().getInformationSchemaViews(); if (!informationSchemaViews.hasAdditionalColumnAttributesSql()) { LOGGER.log(Level.FINE, "Additional column attributes SQL statement was not provided"); return; } final String columnAttributesSql = informationSchemaViews.getAdditionalColumnAttributesSql(); final Connection connection = getDatabaseConnection(); try (final Statement statement = connection.createStatement(); final MetadataResultSet results = new MetadataResultSet(statement.executeQuery(columnAttributesSql)); ) { while (results.next()) { final String catalogName = quotedName(results.getString("TABLE_CATALOG")); final String schemaName = quotedName(results.getString("TABLE_SCHEMA")); final String tableName = quotedName(results.getString("TABLE_NAME")); final String columnName = quotedName(results.getString("COLUMN_NAME")); LOGGER.log(Level.FINER, "Retrieving additional column attributes: " + columnName); final MutableTable table = lookupTable(catalogName, schemaName, tableName); if (table == null) { LOGGER.log( Level.FINE, String.format("Cannot find table, %s.%s.%s", catalogName, schemaName, tableName)); continue; } final MutableColumn column = table.getColumn(columnName); if (column == null) { LOGGER.log( Level.FINE, String.format( "Cannot find column, %s.%s.%s.%s", catalogName, schemaName, tableName, columnName)); continue; } column.addAttributes(results.getAttributes()); } } catch (final Exception e) { LOGGER.log(Level.WARNING, "Could not retrieve additional column attributes", e); } }