SchemaCrawler 在使用 API 时是否损坏?
Is SchemaCrawler broken when using its API?
我指的是 http://sualeh.github.io/SchemaCrawler/how-to.html#api 中的文档
但我从来没有得到我想要的。返回的表总是空的。
final Connection connection = ... // Get a MYSQL connection;
final SchemaCrawlerOptions options = new SchemaCrawlerOptions();
options.setSchemaInfoLevel(SchemaInfoLevelBuilder.maximum());
options.setTableInclusionRule(new IncludeAll());
options.setTableNamePattern("*");
final Catalog catalog = SchemaCrawlerUtility.getCatalog(connection, options);
for (final Schema schema: catalog.getSchemas())
{
Collection<Table> tables = catalog.getTables(schema);
//
// The size of tables is always 0
//
System.out.println(tables);
}
您不应设置 table 名称模式,因此请删除以下行:
options.setTableNamePattern("*");
Sualeh Fatehi,SchemaCrawler
我指的是 http://sualeh.github.io/SchemaCrawler/how-to.html#api 中的文档 但我从来没有得到我想要的。返回的表总是空的。
final Connection connection = ... // Get a MYSQL connection;
final SchemaCrawlerOptions options = new SchemaCrawlerOptions();
options.setSchemaInfoLevel(SchemaInfoLevelBuilder.maximum());
options.setTableInclusionRule(new IncludeAll());
options.setTableNamePattern("*");
final Catalog catalog = SchemaCrawlerUtility.getCatalog(connection, options);
for (final Schema schema: catalog.getSchemas())
{
Collection<Table> tables = catalog.getTables(schema);
//
// The size of tables is always 0
//
System.out.println(tables);
}
您不应设置 table 名称模式,因此请删除以下行:
options.setTableNamePattern("*");
Sualeh Fatehi,SchemaCrawler