/** * Retrieves additional table attributes from the database. * * @throws SQLException On a SQL exception */ void retrieveAdditionalTableAttributes() throws SQLException { final InformationSchemaViews informationSchemaViews = getRetrieverConnection().getInformationSchemaViews(); if (!informationSchemaViews.hasAdditionalTableAttributesSql()) { LOGGER.log(Level.FINE, "Additional table attributes SQL statement was not provided"); return; } final String tableAttributesSql = informationSchemaViews.getAdditionalTableAttributesSql(); final Connection connection = getDatabaseConnection(); try (final Statement statement = connection.createStatement(); final MetadataResultSet results = new MetadataResultSet(statement.executeQuery(tableAttributesSql)); ) { 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")); LOGGER.log(Level.FINER, "Retrieving additional table attributes: " + tableName); 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; } table.addAttributes(results.getAttributes()); } } catch (final Exception e) { LOGGER.log(Level.WARNING, "Could not retrieve additional table attributes", e); } }