【问题标题】:Can't retrieve comments for indexes when using SchemaCrawler and MySQL5.7使用 SchemaCrawler 和 MySQL5.7 时无法检索索引的注释
【发布时间】:2017-04-05 00:44:56
【问题描述】:

我可以使用 SchemaCrawler 和 MySQL5.7 检索表和列的 cmets,但索引的 cmets 失败。这是一个例子:

1) 表定义

create table testtable(
  id bigint unsigned auto_increment,
  city_id varchar(256),
  person_id varchar(256),
  primary key(id) comment 'This is comment for the primary key',
  key idx1 (city_id, person_id) comment 'This is the comment for test index'
) comment='This is the comment for test table';

2) Java 代码

// jdbc:mysql://localhost:3306/testdb?useInformationSchema=true&useUnicode=true&characterEncoding=utf8
final Connection connection = ...;
final DatabaseSpecificOverrideOptions databaseSpecificOverrideOptions =
                        SchemaCrawlerUtility.matchDatabaseSpecificOverrideOptions(connection);

final SchemaCrawler schemaCrawler = new SchemaCrawler(connection, databaseSpecificOverrideOptions);

final SchemaCrawlerOptions options = new SchemaCrawlerOptions();
options.setSchemaInfoLevel(SchemaInfoLevelBuilder.maximum());
options.setTableInclusionRule(new IncludeAll());
options.setColumnInclusionRule(new IncludeAll());

final Catalog catalog = schemaCrawler.crawl(options);
final Collection<schemacrawler.schema.Table> tables = catalog.getTables();

for (schemacrawler.schema.Table t : tables) {
    System.out.println(t.getPrimaryKey().getRemarks());
    for (schemacrawler.schema.Index index : t.getIndexes()) {
        System.out.println(index.getRemarks());
    }
}

有什么需要调整的吗?

谢谢!

【问题讨论】:

    标签: schemacrawler


    【解决方案1】:

    抱歉,SchemaCrawler 14.16.01 中的 MySQL 不支持索引 cmets。请确保在类路径中包含 us.fatehi:schemacrawler-mysql jar file

    Sualeh Fatehi,SchemaCrawler

    【讨论】:

    • 感谢您的澄清。期待看到新版本。
    • 请使用 SchemaCrawler 14.06.01
    猜你喜欢
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-26
    • 2019-02-14
    • 2019-03-31
    • 1970-01-01
    相关资源
    最近更新 更多