codenvy-legacy / plugin-datasource

This repository is deprecated. Visit https://github.com/codenvy/che-plugins
Eclipse Public License 1.0
2 stars 10 forks source link

SchemaCrawler: Investigate why schema.getName is null with mysql #188

Closed sunix closed 10 years ago

sunix commented 10 years ago

https://github.com/codenvy/plugin-datasource/blob/master/codenvy-ext-datasource-server/src/main/java/com/codenvy/ide/ext/datasource/server/DatabaseExploreService.java#L180

With MySQL, This is a workaround: using schema.getFullName() seems not to be null where schema.getName() is null. Why ?

sunix commented 10 years ago

fullname is a concatenation of catalogName and schemaName

private void buildFullName()
{
  if (fullName == null)
  {
    final boolean hasCatalogName = !Utility.isBlank(catalogName);
    final boolean hasSchemaName = !Utility.isBlank(getName());
    fullName = (hasCatalogName? catalogName: "")
               + (hasCatalogName && hasSchemaName? ".": "")
               + (hasSchemaName? getName(): "");
  }
}
sunix commented 10 years ago

It really depends on how a database consider being a catalog and a schema, all database jdbc implementation are keeping these names where it may not exist in some database.