提交 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 { ...@@ -392,7 +392,7 @@ public class ConstraintReferential extends Constraint {
int idx = cols[i].getColumnId(); int idx = cols[i].getColumnId();
Value c = check.getValue(idx); Value c = check.getValue(idx);
Value f = found.getValue(idx); Value f = found.getValue(idx);
if (searchTable.compareTypeSave(c, f) != 0) { if (searchTable.compareTypeSafe(c, f) != 0) {
allEqual = false; allEqual = false;
break; break;
} }
......
...@@ -354,8 +354,8 @@ public class Database implements DataHandler { ...@@ -354,8 +354,8 @@ public class Database implements DataHandler {
* @return 0 if both values are equal, -1 if the first value is smaller, and * @return 0 if both values are equal, -1 if the first value is smaller, and
* 1 otherwise * 1 otherwise
*/ */
public int compareTypeSave(Value a, Value b) { public int compareTypeSafe(Value a, Value b) {
return a.compareTypeSave(b, compareMode); return a.compareTypeSafe(b, compareMode);
} }
public long getModificationDataId() { public long getModificationDataId() {
...@@ -1621,7 +1621,9 @@ public class Database implements DataHandler { ...@@ -1621,7 +1621,9 @@ public class Database implements DataHandler {
removeMeta(session, id); removeMeta(session, id);
addMeta(session, obj); addMeta(session, obj);
// for temporary objects // for temporary objects
objectIds.set(id); if (id > 0) {
objectIds.set(id);
}
} }
/** /**
......
...@@ -1019,7 +1019,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -1019,7 +1019,7 @@ public class Function extends Expression implements FunctionCall {
if (result == ValueNull.INSTANCE) { if (result == ValueNull.INSTANCE) {
result = v; result = v;
} else { } else {
int comp = database.compareTypeSave(result, v); int comp = database.compareTypeSafe(result, v);
if (info.type == GREATEST && comp < 0) { if (info.type == GREATEST && comp < 0) {
result = v; result = v;
} else if (info.type == LEAST && comp > 0) { } else if (info.type == LEAST && comp > 0) {
......
...@@ -315,7 +315,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index { ...@@ -315,7 +315,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
if (aNull || bNull) { if (aNull || bNull) {
return SortOrder.compareNull(aNull, sortType); return SortOrder.compareNull(aNull, sortType);
} }
int comp = table.compareTypeSave(a, b); int comp = table.compareTypeSafe(a, b);
if ((sortType & SortOrder.DESCENDING) != 0) { if ((sortType & SortOrder.DESCENDING) != 0) {
comp = -comp; comp = -comp;
} }
......
...@@ -133,18 +133,18 @@ public class ValueDataType implements DataType { ...@@ -133,18 +133,18 @@ public class ValueDataType implements DataType {
if (aNull || bNull) { if (aNull || bNull) {
return SortOrder.compareNull(aNull, sortType); return SortOrder.compareNull(aNull, sortType);
} }
int comp = compareTypeSave(a, b); int comp = compareTypeSafe(a, b);
if ((sortType & SortOrder.DESCENDING) != 0) { if ((sortType & SortOrder.DESCENDING) != 0) {
comp = -comp; comp = -comp;
} }
return comp; return comp;
} }
private int compareTypeSave(Value a, Value b) { private int compareTypeSafe(Value a, Value b) {
if (a == b) { if (a == b) {
return 0; return 0;
} }
return a.compareTypeSave(b, compareMode); return a.compareTypeSafe(b, compareMode);
} }
@Override @Override
......
...@@ -1089,14 +1089,14 @@ public abstract class Table extends SchemaObjectBase { ...@@ -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 * @return 0 if both values are equal, -1 if the first value is smaller, and
* 1 otherwise * 1 otherwise
*/ */
public int compareTypeSave(Value a, Value b) { public int compareTypeSafe(Value a, Value b) {
if (a == b) { if (a == b) {
return 0; return 0;
} }
int dataType = Value.getHigherOrder(a.getType(), b.getType()); int dataType = Value.getHigherOrder(a.getType(), b.getType());
a = a.convertTo(dataType); a = a.convertTo(dataType);
b = b.convertTo(dataType); b = b.convertTo(dataType);
return a.compareTypeSave(b, compareMode); return a.compareTypeSafe(b, compareMode);
} }
public CompareMode getCompareMode() { public CompareMode getCompareMode() {
......
...@@ -913,7 +913,7 @@ public abstract class Value { ...@@ -913,7 +913,7 @@ public abstract class Value {
* @return 0 if both values are equal, -1 if the other value is smaller, and * @return 0 if both values are equal, -1 if the other value is smaller, and
* 1 otherwise * 1 otherwise
*/ */
public final int compareTypeSave(Value v, CompareMode mode) { public final int compareTypeSafe(Value v, CompareMode mode) {
if (this == v) { if (this == v) {
return 0; return 0;
} else if (this == ValueNull.INSTANCE) { } else if (this == ValueNull.INSTANCE) {
......
...@@ -258,13 +258,13 @@ public class TestValue extends TestBase { ...@@ -258,13 +258,13 @@ public class TestValue extends TestBase {
Value v = useFloat ? (Value) ValueFloat.get((float) d[i]) Value v = useFloat ? (Value) ValueFloat.get((float) d[i])
: (Value) ValueDouble.get(d[i]); : (Value) ValueDouble.get(d[i]);
values[i] = v; values[i] = v;
assertTrue(values[i].compareTypeSave(values[i], null) == 0); assertTrue(values[i].compareTypeSafe(values[i], null) == 0);
assertTrue(v.equals(v)); assertTrue(v.equals(v));
assertEquals(i < 2 ? -1 : i > 2 ? 1 : 0, v.getSignum()); assertEquals(i < 2 ? -1 : i > 2 ? 1 : 0, v.getSignum());
} }
for (int i = 0; i < d.length - 1; i++) { for (int i = 0; i < d.length - 1; i++) {
assertTrue(values[i].compareTypeSave(values[i+1], null) < 0); assertTrue(values[i].compareTypeSafe(values[i+1], null) < 0);
assertTrue(values[i + 1].compareTypeSave(values[i], null) > 0); assertTrue(values[i + 1].compareTypeSafe(values[i], null) > 0);
assertTrue(!values[i].equals(values[i+1])); assertTrue(!values[i].equals(values[i+1]));
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论