提交 fac08d62 authored 作者: Thomas Mueller Graf's avatar Thomas Mueller Graf

Fix typo: rename compareTypeSave to compareTypeSafe

上级 56434ba1
......@@ -392,7 +392,7 @@ public class ConstraintReferential extends Constraint {
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;
}
......
......@@ -354,8 +354,8 @@ public class Database implements DataHandler {
* @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() {
......@@ -1621,8 +1621,10 @@ public class Database implements DataHandler {
removeMeta(session, id);
addMeta(session, obj);
// for temporary objects
if (id > 0) {
objectIds.set(id);
}
}
/**
* Rename a schema object.
......
......@@ -1019,7 +1019,7 @@ public class Function extends Expression implements FunctionCall {
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) {
......
......@@ -315,7 +315,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
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;
}
......
......@@ -133,18 +133,18 @@ public class ValueDataType implements DataType {
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
......
......@@ -1089,14 +1089,14 @@ public abstract class Table extends SchemaObjectBase {
* @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() {
......
......@@ -913,7 +913,7 @@ public abstract class Value {
* @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) {
......
......@@ -258,13 +258,13 @@ public class TestValue extends TestBase {
Value v = useFloat ? (Value) ValueFloat.get((float) d[i])
: (Value) ValueDouble.get(d[i]);
values[i] = v;
assertTrue(values[i].compareTypeSave(values[i], null) == 0);
assertTrue(values[i].compareTypeSafe(values[i], null) == 0);
assertTrue(v.equals(v));
assertEquals(i < 2 ? -1 : i > 2 ? 1 : 0, v.getSignum());
}
for (int i = 0; i < d.length - 1; i++) {
assertTrue(values[i].compareTypeSave(values[i+1], null) < 0);
assertTrue(values[i + 1].compareTypeSave(values[i], null) > 0);
assertTrue(values[i].compareTypeSafe(values[i+1], null) < 0);
assertTrue(values[i + 1].compareTypeSafe(values[i], null) > 0);
assertTrue(!values[i].equals(values[i+1]));
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论