HHH-7195 Table does not handle quoted catalog
This commit is contained in:
parent
3f6e6339d9
commit
5068b8e808
|
@ -2804,7 +2804,7 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
|
||||
public String getLogicalTableName(Table table) throws MappingException {
|
||||
return getLogicalTableName( table.getQuotedSchema(), table.getCatalog(), table.getQuotedName() );
|
||||
return getLogicalTableName( table.getQuotedSchema(), table.getQuotedCatalog(), table.getQuotedName() );
|
||||
}
|
||||
|
||||
private String getLogicalTableName(String schema, String catalog, String physicalName) throws MappingException {
|
||||
|
@ -2919,7 +2919,7 @@ public class Configuration implements Serializable {
|
|||
finalName = ( String ) binding.logicalToPhysical.get( logicalName );
|
||||
}
|
||||
String key = buildTableNameKey(
|
||||
currentTable.getQuotedSchema(), currentTable.getCatalog(), currentTable.getQuotedName()
|
||||
currentTable.getQuotedSchema(), currentTable.getQuotedCatalog(), currentTable.getQuotedName()
|
||||
);
|
||||
TableDescription description = ( TableDescription ) tableNameBinding.get( key );
|
||||
if ( description != null ) {
|
||||
|
@ -2948,7 +2948,7 @@ public class Configuration implements Serializable {
|
|||
logical = ( String ) binding.physicalToLogical.get( physicalName );
|
||||
}
|
||||
String key = buildTableNameKey(
|
||||
currentTable.getQuotedSchema(), currentTable.getCatalog(), currentTable.getQuotedName()
|
||||
currentTable.getQuotedSchema(), currentTable.getQuotedCatalog(), currentTable.getQuotedName()
|
||||
);
|
||||
description = ( TableDescription ) tableNameBinding.get( key );
|
||||
if ( description != null ) {
|
||||
|
|
|
@ -60,6 +60,7 @@ public class Table implements RelationalModel, Serializable {
|
|||
private final int uniqueInteger;
|
||||
private boolean quoted;
|
||||
private boolean schemaQuoted;
|
||||
private boolean catalogQuoted;
|
||||
private static int tableCounter = 0;
|
||||
private List checkConstraints = new ArrayList();
|
||||
private String rowId;
|
||||
|
@ -117,7 +118,7 @@ public class Table implements RelationalModel, Serializable {
|
|||
getQuotedSchema( dialect );
|
||||
String usedCatalog = catalog == null ?
|
||||
defaultCatalog :
|
||||
catalog;
|
||||
getQuotedCatalog( dialect );
|
||||
return qualify( usedCatalog, usedSchema, quotedName );
|
||||
}
|
||||
|
||||
|
@ -166,6 +167,18 @@ public class Table implements RelationalModel, Serializable {
|
|||
schema;
|
||||
}
|
||||
|
||||
public String getQuotedCatalog() {
|
||||
return catalogQuoted ?
|
||||
"`" + catalog + "`" :
|
||||
catalog;
|
||||
}
|
||||
|
||||
public String getQuotedCatalog(Dialect dialect) {
|
||||
return catalogQuoted ?
|
||||
dialect.openQuote() + catalog + dialect.closeQuote() :
|
||||
catalog;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
if ( name.charAt( 0 ) == '`' ) {
|
||||
quoted = true;
|
||||
|
@ -651,7 +664,13 @@ public class Table implements RelationalModel, Serializable {
|
|||
}
|
||||
|
||||
public void setCatalog(String catalog) {
|
||||
this.catalog = catalog;
|
||||
if ( catalog != null && catalog.charAt( 0 ) == '`' ) {
|
||||
catalogQuoted = true;
|
||||
this.catalog = catalog.substring( 1, catalog.length() - 1 );
|
||||
}
|
||||
else {
|
||||
this.catalog = catalog;
|
||||
}
|
||||
}
|
||||
|
||||
public int getUniqueInteger() {
|
||||
|
@ -669,6 +688,9 @@ public class Table implements RelationalModel, Serializable {
|
|||
public boolean isSchemaQuoted() {
|
||||
return schemaQuoted;
|
||||
}
|
||||
public boolean isCatalogQuoted() {
|
||||
return catalogQuoted;
|
||||
}
|
||||
|
||||
public boolean isQuoted() {
|
||||
return quoted;
|
||||
|
|
Loading…
Reference in New Issue