[#6416] Add Name.unquotedName() and Name.quotedName()

This commit is contained in:
lukaseder 2017-07-14 16:51:47 +02:00
parent db77c8addf
commit d4521560b9
4 changed files with 41 additions and 1 deletions

View File

@ -1315,7 +1315,7 @@ public abstract class AbstractDatabase implements Database {
// as USER-DEFINED (in PostgreSQL)
&& ( StringUtils.isBlank(definedType.getUserType())
|| !p.matcher(definedType.getUserType()).matches()
&& !p.matcher(definedType.getQualifiedUserType().toString().replace("\"", "")).matches() )
&& !p.matcher(definedType.getQualifiedUserType().unquotedName().toString()).matches() )
) {
continue forcedTypeLoop;
}

View File

@ -92,6 +92,16 @@ public interface Name extends QueryPart {
*/
Name unqualifiedName();
/**
* This name, quoted.
*/
Name quotedName();
/**
* This name, unquoted.
*/
Name unquotedName();
/**
* Get the individual, unqualified name parts of this name.
*/

View File

@ -173,6 +173,26 @@ final class QualifiedName extends AbstractName {
return qualifiedName[qualifiedName.length - 1];
}
@Override
public final Name quotedName() {
Name[] result = new Name[qualifiedName.length];
for (int i = 0; i < result.length; i++)
result[i] = qualifiedName[i].quotedName();
return new QualifiedName(result);
}
@Override
public final Name unquotedName() {
Name[] result = new Name[qualifiedName.length];
for (int i = 0; i < result.length; i++)
result[i] = qualifiedName[i].unquotedName();
return new QualifiedName(result);
}
@Override
public final String[] getName() {
String[] result = new String[qualifiedName.length];

View File

@ -99,6 +99,16 @@ final class UnqualifiedName extends AbstractName {
return this;
}
@Override
public final Name quotedName() {
return new UnqualifiedName(name, true);
}
@Override
public final Name unquotedName() {
return new UnqualifiedName(name, false);
}
@Override
public final String[] getName() {
return new String[] { name };