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 (DBIdentifierType.CONSTANT != getType() && DBIdentifierType.COLUMN_DEFINITION != getType()) {
|
||||||
if (delimit) {
|
if (delimit) {
|
||||||
name = Normalizer.delimit(name, true);
|
name = Normalizer.delimit(name, true);
|
||||||
|
setNameDelimited(true);
|
||||||
} else {
|
} else {
|
||||||
name = Normalizer.normalizeString(name);
|
name = Normalizer.normalizeString(name);
|
||||||
}
|
}
|
||||||
|
@ -325,6 +326,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
|
||||||
sName.setNameInternal(getNameInternal());
|
sName.setNameInternal(getNameInternal());
|
||||||
sName.setType(getType());
|
sName.setType(getType());
|
||||||
sName.setIgnoreCase(getIgnoreCase());
|
sName.setIgnoreCase(getIgnoreCase());
|
||||||
|
sName.setNameDelimited(isNameDelimited());
|
||||||
return sName;
|
return sName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,7 +861,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
public static DBIdentifier removeDelimiters(DBIdentifier name) {
|
public static DBIdentifier removeDelimiters(DBIdentifier name) {
|
||||||
if (DBIdentifier.isNull(name)) {
|
if (DBIdentifier.isNull(name) || !name.isDelimited()) {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
if (!name.isDelimited()) {
|
if (!name.isDelimited()) {
|
||||||
|
@ -927,7 +929,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
|
||||||
if (DBIdentifier.isEmpty(this)) {
|
if (DBIdentifier.isEmpty(this)) {
|
||||||
return false;
|
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 static final long serialVersionUID = 1L;
|
||||||
private String _name = null;
|
private String _name = null;
|
||||||
|
private boolean nameDelimited = false;
|
||||||
|
|
||||||
protected IdentifierImpl() {}
|
protected IdentifierImpl() {}
|
||||||
|
|
||||||
|
@ -45,6 +46,14 @@ public class IdentifierImpl implements Identifier, Serializable {
|
||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNameDelimited() {
|
||||||
|
return nameDelimited;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameDelimited(boolean nameDelimited) {
|
||||||
|
this.nameDelimited = nameDelimited;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getName();
|
return getName();
|
||||||
|
|
Loading…
Reference in New Issue