Skip to content

Commit

Permalink
HHH-13788 Schema update try to recreate existing tables
Browse files Browse the repository at this point in the history
  • Loading branch information
dreab8 committed Dec 17, 2019
1 parent d662d0c commit 00ee6c1
Showing 1 changed file with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,12 @@ else if ( extractionContext.getDefaultCatalog() != null ) {
catalogFilter = toMetaDataObjectName( extractionContext.getDefaultCatalog() );
}
else {
catalogFilter = "";
try {
catalogFilter = extractionContext.getJdbcConnection().getCatalog();
}
catch (SQLException ignore) {
log.sqlWarning( ignore.getErrorCode(), ignore.getSQLState() );
}
}
}
else {
Expand All @@ -321,7 +326,12 @@ else if ( extractionContext.getDefaultSchema() != null ) {
schemaFilter = toMetaDataObjectName( extractionContext.getDefaultSchema() );
}
else {
schemaFilter = "";
try {
schemaFilter = extractionContext.getJdbcConnection().getSchema();
}
catch (SQLException ignore) {
log.sqlWarning( ignore.getErrorCode(), ignore.getSQLState() );
}
}
}
else {
Expand Down Expand Up @@ -417,42 +427,38 @@ private TableInformation locateTableInNamespace(
Identifier catalogToUse = null;
Identifier schemaToUse = null;

final String catalogFilter;
final String schemaFilter;
String catalogFilter = null;
String schemaFilter = null;

if ( extractionContext.getJdbcEnvironment().getNameQualifierSupport().supportsCatalogs() ) {
if ( catalog == null ) {
String defaultCatalog = "";
if ( extractionContext.getJdbcEnvironment().getNameQualifierSupport().supportsCatalogs() ) {
try {
defaultCatalog = extractionContext.getJdbcConnection().getCatalog();
}
catch (SQLException ignore) {
}
try {
catalogFilter = extractionContext.getJdbcConnection().getCatalog();
}
catch (SQLException ignore) {
log.sqlWarning( ignore.getErrorCode(), ignore.getSQLState() );
}
catalogFilter = defaultCatalog;
}
else {
catalogToUse = catalog;
catalogFilter = toMetaDataObjectName( catalog );
}
}
else {
catalogFilter = null;
}

if ( extractionContext.getJdbcEnvironment().getNameQualifierSupport().supportsSchemas() ) {
if ( schema == null ) {
schemaFilter = "";
try {
schemaFilter = extractionContext.getJdbcConnection().getSchema();
}
catch (SQLException ignore) {
log.sqlWarning( ignore.getErrorCode(), ignore.getSQLState() );
}
}
else {
schemaToUse = schema;
schemaFilter = toMetaDataObjectName( schema );
}
}
else {
schemaFilter = null;
}

final String tableNameFilter = toMetaDataObjectName( tableName );

Expand Down

0 comments on commit 00ee6c1

Please sign in to comment.