Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ public Identifier normalizeQuoting(Identifier identifier) {

// need to quote names containing special characters like ':'
if ( !normalizedIdentifier.isQuoted() && !normalizedIdentifier.getText().matches( "\\w+" ) ) {
normalizedIdentifier = Identifier.quote( normalizedIdentifier );
normalizedIdentifier = normalizedIdentifier.quoted();
}

return normalizedIdentifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,15 +488,15 @@ private static Identifier quoteIfNecessary(
boolean isRefColumnQuoted, Identifier logicalTableName, Identifier columnIdentifier) {
return !columnIdentifier.isQuoted()
&& ( isRefColumnQuoted || logicalTableName.isQuoted() )
? Identifier.quote( columnIdentifier )
? columnIdentifier.quoted()
: columnIdentifier;
}

private static Identifier quoteIfNecessary(
boolean isRefColumnQuoted, String logicalTableName, Identifier columnIdentifier) {
//one element was quoted so we quote
return isRefColumnQuoted || isQuoted( logicalTableName )
? Identifier.quote( columnIdentifier )
? columnIdentifier.quoted()
: columnIdentifier;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public MetadataBuildingContext getBuildingContext() {
}

if ( ownerEntityTableQuoted || associatedEntityTableQuoted ) {
name = Identifier.quote( name );
name = name.quoted();
}

return name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ public boolean isQuoted() {
return isQuoted;
}

/**
* A quoted form of this identifier.
*/
public Identifier quoted() {
return isQuoted ? this : toIdentifier( text, true );
}

/**
* If this is a quoted identifier, then return the identifier name
* enclosed in dialect-specific open- and end-quotes; otherwise,
Expand Down Expand Up @@ -272,18 +279,20 @@ public int hashCode() {
: text.toLowerCase( Locale.ENGLISH ).hashCode();
}

@Override
public int compareTo(Identifier identifier) {
return getCanonicalName().compareTo( identifier.getCanonicalName() );
}

public static boolean areEqual(Identifier id1, Identifier id2) {
return Objects.equals( id1, id2 );
}

/**
* @deprecated Use {@link #quoted()}.
*/
@Deprecated(since = "7.1", forRemoval = true)
public static Identifier quote(Identifier identifier) {
return identifier.isQuoted()
? identifier
: Identifier.toIdentifier( identifier.getText(), true );
}

@Override
public int compareTo(Identifier identifier) {
return getCanonicalName().compareTo( identifier.getCanonicalName() );
return identifier.quoted();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Identifier determineCollectionTableName(ImplicitCollectionTableNameSource
+ "_" + transformAttributePath( source.getOwningAttributePath() ),
source.getBuildingContext()
);
return owningPhysicalTableName.isQuoted() ? Identifier.quote( identifier ) : identifier;
return owningPhysicalTableName.isQuoted() ? identifier.quoted() : identifier;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ public Identifier normalizeQuoting(Identifier identifier) {

// need to quote names containing special characters like ':'
if ( !normalizedIdentifier.isQuoted() && !normalizedIdentifier.getText().matches( "\\w+" ) ) {
normalizedIdentifier = Identifier.quote( normalizedIdentifier );
normalizedIdentifier = normalizedIdentifier.quoted();
}

return normalizedIdentifier;
Expand Down