final Catalog catalog = SchemaCrawlerUtility.getCatalog(getConnection(), options);
/** * Returns database specific options using an existing SchemaCrawler * database plugin. * * @return SchemaRetrievalOptions * @throws SchemaCrawlerException * On an exception. */ public static SchemaRetrievalOptions matchSchemaRetrievalOptions(final Connection connection) throws SchemaCrawlerException { final SchemaRetrievalOptionsBuilder schemaRetrievalOptionsBuilder = buildSchemaRetrievalOptions(connection); final SchemaRetrievalOptions schemaRetrievalOptions = schemaRetrievalOptionsBuilder .toOptions(); return schemaRetrievalOptions; }
/** * Crawls a database, and returns a catalog. * * @param connection * Live database connection. * @param schemaCrawlerOptions * Options. * @return Database catalog. * @throws SchemaCrawlerException * On an exception. */ public static Catalog getCatalog(final Connection connection, final SchemaCrawlerOptions schemaCrawlerOptions) throws SchemaCrawlerException { checkConnection(connection); if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, ObjectToString.toString(schemaCrawlerOptions)); } final SchemaRetrievalOptions schemaRetrievalOptions = matchSchemaRetrievalOptions(connection); final SchemaCrawler schemaCrawler = new SchemaCrawler(connection, schemaRetrievalOptions, schemaCrawlerOptions); final Catalog catalog = schemaCrawler.crawl(); return catalog; }
/** * Obtains result-set metadata from a live result-set. * * @param resultSet * Live result-set. * @return Result-set metadata. * @throws SchemaCrawlerException * On an exception. */ public static ResultsColumns getResultsColumns(final ResultSet resultSet) throws SchemaCrawlerException { // NOTE: Some JDBC drivers like SQLite may not work with closed // result-sets checkResultSet(resultSet); final ResultsCrawler resultSetCrawler = new ResultsCrawler(resultSet); final ResultsColumns resultsColumns = resultSetCrawler.crawl(); return resultsColumns; }
/** * Allows building of database specific options programatically, using * an existing SchemaCrawler database plugin as a starting point. * * @return SchemaRetrievalOptionsBuilder * @throws SchemaCrawlerException * On an exception. */ private static SchemaRetrievalOptionsBuilder buildSchemaRetrievalOptions(final Connection connection) throws SchemaCrawlerException { checkConnection(connection); final DatabaseConnectorRegistry registry = new DatabaseConnectorRegistry(); final DatabaseConnector dbConnector = registry .lookupDatabaseConnector(connection); LOGGER .log(Level.INFO, "Using database plugin for " + dbConnector.getDatabaseServerType()); final SchemaRetrievalOptionsBuilder schemaRetrievalOptionsBuilder = dbConnector .getSchemaRetrievalOptionsBuilder(connection); return schemaRetrievalOptionsBuilder; }
public final void execute() throws Exception { requireNonNull(connection, "No connection provided"); if (schemaRetrievalOptions == null) { schemaRetrievalOptions = SchemaCrawlerUtility .matchSchemaRetrievalOptions(connection); } logExecution(); // Load the command to see if it is available // Fail early (before loading the catalog) if the command is not // available final SchemaCrawlerCommand scCommand = loadCommand(); scCommand.initialize(); scCommand.checkAvailibility(); final Catalog catalog = loadCatalog(); // Reduce all once again, since the catalog may have been loaded // from an offline or other source reduceCatalog(catalog); scCommand.setCatalog(catalog); scCommand.setConnection(connection); LOGGER.log(Level.INFO, new StringFormat("Executing command <%s> using <%s>", command, scCommand.getClass().getName())); scCommand.execute(); }
.getResultsColumns(results); for (final ResultsColumn column: resultColumns)
public DataResultSet(final ResultSet rows, final boolean showLobs) throws SchemaCrawlerException { if (rows == null) { throw new IllegalArgumentException("Cannot use null results"); } this.rows = rows; this.showLobs = showLobs; resultsColumns = SchemaCrawlerUtility.getResultColumns(rows).getColumns(); }
/** * Obtains result-set metadata from a live result-set. * * @param resultSet * Live result-set. * @return Result-set metadata. * @throws SchemaCrawlerException * On an exception. */ public static ResultsColumns getResultsColumns(final ResultSet resultSet) throws SchemaCrawlerException { // NOTE: Some JDBC drivers like SQLite may not work with closed // result-sets checkResultSet(resultSet); final ResultsCrawler resultSetCrawler = new ResultsCrawler(resultSet); final ResultsColumns resultsColumns = resultSetCrawler.crawl(); return resultsColumns; }
/** * Allows building of database specific options programatically, using * an existing SchemaCrawler database plugin as a starting point. * * @return SchemaRetrievalOptionsBuilder * @throws SchemaCrawlerException * On an exception. */ private static SchemaRetrievalOptionsBuilder buildSchemaRetrievalOptions(final Connection connection) throws SchemaCrawlerException { checkConnection(connection); final DatabaseConnectorRegistry registry = new DatabaseConnectorRegistry(); final DatabaseConnector dbConnector = registry .lookupDatabaseConnector(connection); LOGGER .log(Level.INFO, "Using database plugin for " + dbConnector.getDatabaseServerType()); final SchemaRetrievalOptionsBuilder schemaRetrievalOptionsBuilder = dbConnector .getSchemaRetrievalOptionsBuilder(connection); return schemaRetrievalOptionsBuilder; }
public final void execute() throws Exception { requireNonNull(connection, "No connection provided"); if (schemaRetrievalOptions == null) { schemaRetrievalOptions = SchemaCrawlerUtility .matchSchemaRetrievalOptions(connection); } logExecution(); // Load the command to see if it is available // Fail early (before loading the catalog) if the command is not // available final SchemaCrawlerCommand scCommand = loadCommand(); scCommand.initialize(); scCommand.checkAvailibility(); final Catalog catalog = loadCatalog(); // Reduce all once again, since the catalog may have been loaded // from an offline or other source reduceCatalog(catalog); scCommand.setCatalog(catalog); scCommand.setConnection(connection); LOGGER.log(Level.INFO, new StringFormat("Executing command <%s> using <%s>", command, scCommand.getClass().getName())); scCommand.execute(); }
/** * Crawls a database, and returns a catalog. * * @param connection * Live database connection. * @param schemaCrawlerOptions * Options. * @return Database catalog. * @throws SchemaCrawlerException * On an exception. */ public static Catalog getCatalog(final Connection connection, final SchemaCrawlerOptions schemaCrawlerOptions) throws SchemaCrawlerException { checkConnection(connection); if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, ObjectToString.toString(schemaCrawlerOptions)); } final SchemaRetrievalOptions schemaRetrievalOptions = matchSchemaRetrievalOptions(connection); final SchemaCrawler schemaCrawler = new SchemaCrawler(connection, schemaRetrievalOptions, schemaCrawlerOptions); final Catalog catalog = schemaCrawler.crawl(); return catalog; }
protected Catalog loadCatalog(DataSource dataSource, SchemaCrawlerOptions options) throws SchemaCrawlerException, SQLException { return SchemaCrawlerUtility.getCatalog( dataSource.getConnection(), options); }
/** * Returns database specific options using an existing SchemaCrawler * database plugin. * * @return SchemaRetrievalOptions * @throws SchemaCrawlerException * On an exception. */ public static SchemaRetrievalOptions matchSchemaRetrievalOptions(final Connection connection) throws SchemaCrawlerException { final SchemaRetrievalOptionsBuilder schemaRetrievalOptionsBuilder = buildSchemaRetrievalOptions(connection); final SchemaRetrievalOptions schemaRetrievalOptions = schemaRetrievalOptionsBuilder .toOptions(); return schemaRetrievalOptions; }
/** * Obtains result-set metadata from a live result-set. * * @param resultSet * Live result-set. * @return Result-set metadata. * @throws SchemaCrawlerException * On an exception. */ public static ResultsColumns getResultsColumns(final ResultSet resultSet) throws SchemaCrawlerException { // NOTE: Some JDBC drivers like SQLite may not work with closed // result-sets checkResultSet(resultSet); final ResultsCrawler resultSetCrawler = new ResultsCrawler(resultSet); final ResultsColumns resultsColumns = resultSetCrawler.crawl(); return resultsColumns; }
/** * Allows building of database specific options programatically, using * an existing SchemaCrawler database plugin as a starting point. * * @return SchemaRetrievalOptionsBuilder * @throws SchemaCrawlerException * On an exception. */ private static SchemaRetrievalOptionsBuilder buildSchemaRetrievalOptions(final Connection connection) throws SchemaCrawlerException { checkConnection(connection); final DatabaseConnectorRegistry registry = new DatabaseConnectorRegistry(); final DatabaseConnector dbConnector = registry .lookupDatabaseConnector(connection); LOGGER .log(Level.INFO, "Using database plugin for " + dbConnector.getDatabaseServerType()); final SchemaRetrievalOptionsBuilder schemaRetrievalOptionsBuilder = dbConnector .getSchemaRetrievalOptionsBuilder(connection); return schemaRetrievalOptionsBuilder; }
public final void execute() throws Exception { requireNonNull(connection, "No connection provided"); if (schemaRetrievalOptions == null) { schemaRetrievalOptions = SchemaCrawlerUtility .matchSchemaRetrievalOptions(connection); } logExecution(); // Load the command to see if it is available // Fail early (before loading the catalog) if the command is not // available final SchemaCrawlerCommand scCommand = loadCommand(); scCommand.initialize(); scCommand.checkAvailibility(); final Catalog catalog = loadCatalog(); // Reduce all once again, since the catalog may have been loaded // from an offline or other source reduceCatalog(catalog); scCommand.setCatalog(catalog); scCommand.setConnection(connection); LOGGER.log(Level.INFO, new StringFormat("Executing command <%s> using <%s>", command, scCommand.getClass().getName())); scCommand.execute(); }
/** * Crawls a database, and returns a catalog. * * @param connection * Live database connection. * @param schemaCrawlerOptions * Options. * @return Database catalog. * @throws SchemaCrawlerException * On an exception. */ public static Catalog getCatalog(final Connection connection, final SchemaCrawlerOptions schemaCrawlerOptions) throws SchemaCrawlerException { checkConnection(connection); if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, ObjectToString.toString(schemaCrawlerOptions)); } final SchemaRetrievalOptions schemaRetrievalOptions = matchSchemaRetrievalOptions(connection); final SchemaCrawler schemaCrawler = new SchemaCrawler(connection, schemaRetrievalOptions, schemaCrawlerOptions); final Catalog catalog = schemaCrawler.crawl(); return catalog; }
final Catalog catalog = SchemaCrawlerUtility.getCatalog(conn, options); System.out.println("schem ! ");
/** * Returns database specific options using an existing SchemaCrawler * database plugin. * * @return SchemaRetrievalOptions * @throws SchemaCrawlerException * On an exception. */ public static SchemaRetrievalOptions matchSchemaRetrievalOptions(final Connection connection) throws SchemaCrawlerException { final SchemaRetrievalOptionsBuilder schemaRetrievalOptionsBuilder = buildSchemaRetrievalOptions(connection); final SchemaRetrievalOptions schemaRetrievalOptions = schemaRetrievalOptionsBuilder .toOptions(); return schemaRetrievalOptions; }