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 {
|
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 {
|
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 );
|
finalName = ( String ) binding.logicalToPhysical.get( logicalName );
|
||||||
}
|
}
|
||||||
String key = buildTableNameKey(
|
String key = buildTableNameKey(
|
||||||
currentTable.getQuotedSchema(), currentTable.getCatalog(), currentTable.getQuotedName()
|
currentTable.getQuotedSchema(), currentTable.getQuotedCatalog(), currentTable.getQuotedName()
|
||||||
);
|
);
|
||||||
TableDescription description = ( TableDescription ) tableNameBinding.get( key );
|
TableDescription description = ( TableDescription ) tableNameBinding.get( key );
|
||||||
if ( description != null ) {
|
if ( description != null ) {
|
||||||
|
@ -2948,7 +2948,7 @@ public class Configuration implements Serializable {
|
||||||
logical = ( String ) binding.physicalToLogical.get( physicalName );
|
logical = ( String ) binding.physicalToLogical.get( physicalName );
|
||||||
}
|
}
|
||||||
String key = buildTableNameKey(
|
String key = buildTableNameKey(
|
||||||
currentTable.getQuotedSchema(), currentTable.getCatalog(), currentTable.getQuotedName()
|
currentTable.getQuotedSchema(), currentTable.getQuotedCatalog(), currentTable.getQuotedName()
|
||||||
);
|
);
|
||||||
description = ( TableDescription ) tableNameBinding.get( key );
|
description = ( TableDescription ) tableNameBinding.get( key );
|
||||||
if ( description != null ) {
|
if ( description != null ) {
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class Table implements RelationalModel, Serializable {
|
||||||
private final int uniqueInteger;
|
private final int uniqueInteger;
|
||||||
private boolean quoted;
|
private boolean quoted;
|
||||||
private boolean schemaQuoted;
|
private boolean schemaQuoted;
|
||||||
|
private boolean catalogQuoted;
|
||||||
private static int tableCounter = 0;
|
private static int tableCounter = 0;
|
||||||
private List checkConstraints = new ArrayList();
|
private List checkConstraints = new ArrayList();
|
||||||
private String rowId;
|
private String rowId;
|
||||||
|
@ -117,7 +118,7 @@ public class Table implements RelationalModel, Serializable {
|
||||||
getQuotedSchema( dialect );
|
getQuotedSchema( dialect );
|
||||||
String usedCatalog = catalog == null ?
|
String usedCatalog = catalog == null ?
|
||||||
defaultCatalog :
|
defaultCatalog :
|
||||||
catalog;
|
getQuotedCatalog( dialect );
|
||||||
return qualify( usedCatalog, usedSchema, quotedName );
|
return qualify( usedCatalog, usedSchema, quotedName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +167,18 @@ public class Table implements RelationalModel, Serializable {
|
||||||
schema;
|
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) {
|
public void setName(String name) {
|
||||||
if ( name.charAt( 0 ) == '`' ) {
|
if ( name.charAt( 0 ) == '`' ) {
|
||||||
quoted = true;
|
quoted = true;
|
||||||
|
@ -651,8 +664,14 @@ public class Table implements RelationalModel, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCatalog(String catalog) {
|
public void setCatalog(String catalog) {
|
||||||
|
if ( catalog != null && catalog.charAt( 0 ) == '`' ) {
|
||||||
|
catalogQuoted = true;
|
||||||
|
this.catalog = catalog.substring( 1, catalog.length() - 1 );
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.catalog = catalog;
|
this.catalog = catalog;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getUniqueInteger() {
|
public int getUniqueInteger() {
|
||||||
return uniqueInteger;
|
return uniqueInteger;
|
||||||
|
@ -669,6 +688,9 @@ public class Table implements RelationalModel, Serializable {
|
||||||
public boolean isSchemaQuoted() {
|
public boolean isSchemaQuoted() {
|
||||||
return schemaQuoted;
|
return schemaQuoted;
|
||||||
}
|
}
|
||||||
|
public boolean isCatalogQuoted() {
|
||||||
|
return catalogQuoted;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isQuoted() {
|
public boolean isQuoted() {
|
||||||
return quoted;
|
return quoted;
|
||||||
|
|
Loading…
Reference in New Issue