Skip to content

Commit

Permalink
rename compareTypeSave to compareTypeSafe
Browse files Browse the repository at this point in the history
  • Loading branch information
codefollower committed Aug 21, 2015
1 parent 9a8e850 commit 02387ad
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lealone-common/src/main/java/org/lealone/value/Value.java
Expand Up @@ -845,7 +845,7 @@ public Value convertTo(int targetType) {
* @return 0 if both values are equal, -1 if the other value is smaller, and
* 1 otherwise
*/
public final int compareTypeSave(Value v, CompareMode mode) {
public final int compareTypeSafe(Value v, CompareMode mode) {
if (this == v) {
return 0;
} else if (this == ValueNull.INSTANCE) {
Expand Down
Expand Up @@ -120,18 +120,18 @@ private int compareValues(Value a, Value b, int sortType) {
if (aNull || bNull) {
return SortOrder.compareNull(aNull, sortType);
}
int comp = compareTypeSave(a, b);
int comp = compareTypeSafe(a, b);
if ((sortType & SortOrder.DESCENDING) != 0) {
comp = -comp;
}
return comp;
}

private int compareTypeSave(Value a, Value b) {
private int compareTypeSafe(Value a, Value b) {
if (a == b) {
return 0;
}
return a.compareTypeSave(b, compareMode);
return a.compareTypeSafe(b, compareMode);
}

@Override
Expand Down
Expand Up @@ -388,7 +388,7 @@ private boolean existsRow(Session session, Index searchIndex, SearchRow check, R
int idx = cols[i].getColumnId();
Value c = check.getValue(idx);
Value f = found.getValue(idx);
if (searchTable.compareTypeSave(c, f) != 0) {
if (searchTable.compareTypeSafe(c, f) != 0) {
allEqual = false;
break;
}
Expand Down
Expand Up @@ -316,7 +316,7 @@ private int compareValues(Value a, Value b, int sortType) {
if (aNull || bNull) {
return SortOrder.compareNull(aNull, sortType);
}
int comp = table.compareTypeSave(a, b);
int comp = table.compareTypeSafe(a, b);
if ((sortType & SortOrder.DESCENDING) != 0) {
comp = -comp;
}
Expand Down
Expand Up @@ -1072,14 +1072,14 @@ public boolean isPersistData() {
* @return 0 if both values are equal, -1 if the first value is smaller, and
* 1 otherwise
*/
public int compareTypeSave(Value a, Value b) {
public int compareTypeSafe(Value a, Value b) {
if (a == b) {
return 0;
}
int dataType = Value.getHigherOrder(a.getType(), b.getType());
a = a.convertTo(dataType);
b = b.convertTo(dataType);
return a.compareTypeSave(b, compareMode);
return a.compareTypeSafe(b, compareMode);
}

public CompareMode getCompareMode() {
Expand Down
4 changes: 2 additions & 2 deletions lealone-sql/src/main/java/org/lealone/engine/Database.java
Expand Up @@ -421,8 +421,8 @@ public int compare(Value a, Value b) {
* @return 0 if both values are equal, -1 if the first value is smaller, and
* 1 otherwise
*/
public int compareTypeSave(Value a, Value b) {
return a.compareTypeSave(b, compareMode);
public int compareTypeSafe(Value a, Value b) {
return a.compareTypeSafe(b, compareMode);
}

public long getModificationDataId() {
Expand Down
Expand Up @@ -864,7 +864,7 @@ private Value getSimpleValue(Session session, Value v0, Expression[] args, Value
if (result == ValueNull.INSTANCE) {
result = v;
} else {
int comp = database.compareTypeSave(result, v);
int comp = database.compareTypeSafe(result, v);
if (info.type == GREATEST && comp < 0) {
result = v;
} else if (info.type == LEAST && comp > 0) {
Expand Down

0 comments on commit 02387ad

Please sign in to comment.