mirror of https://github.com/apache/openjpa.git
Merge pull request #71 from eolivelli/fix/OPENJPA-2820-delim
OPENJPA-2820 Track when a DBIdentifier is already delimited in order to save memory allocations and cpu
This commit is contained in:
commit
049c2ef163
|
@ -142,6 +142,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
|
|||
if (DBIdentifierType.CONSTANT != getType() && DBIdentifierType.COLUMN_DEFINITION != getType()) {
|
||||
if (delimit) {
|
||||
name = Normalizer.delimit(name, true);
|
||||
setNameDelimited(true);
|
||||
} else {
|
||||
name = Normalizer.normalizeString(name);
|
||||
}
|
||||
|
@ -325,6 +326,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
|
|||
sName.setNameInternal(getNameInternal());
|
||||
sName.setType(getType());
|
||||
sName.setIgnoreCase(getIgnoreCase());
|
||||
sName.setNameDelimited(isNameDelimited());
|
||||
return sName;
|
||||
}
|
||||
|
||||
|
@ -859,7 +861,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
|
|||
* @param name
|
||||
*/
|
||||
public static DBIdentifier removeDelimiters(DBIdentifier name) {
|
||||
if (DBIdentifier.isNull(name)) {
|
||||
if (DBIdentifier.isNull(name) || !name.isDelimited()) {
|
||||
return name;
|
||||
}
|
||||
if (!name.isDelimited()) {
|
||||
|
@ -927,7 +929,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
|
|||
if (DBIdentifier.isEmpty(this)) {
|
||||
return false;
|
||||
}
|
||||
return Normalizer.isDelimited(getNameInternal());
|
||||
return isNameDelimited() || Normalizer.isDelimited(getNameInternal());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,7 @@ public class IdentifierImpl implements Identifier, Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String _name = null;
|
||||
private boolean nameDelimited = false;
|
||||
|
||||
protected IdentifierImpl() {}
|
||||
|
||||
|
@ -45,6 +46,14 @@ public class IdentifierImpl implements Identifier, Serializable {
|
|||
return _name;
|
||||
}
|
||||
|
||||
public boolean isNameDelimited() {
|
||||
return nameDelimited;
|
||||
}
|
||||
|
||||
public void setNameDelimited(boolean nameDelimited) {
|
||||
this.nameDelimited = nameDelimited;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
|
|
Loading…
Reference in New Issue