private static Value divide(Value a, long by) { if (by == 0) { return ValueNull.INSTANCE; } int type = Value.getHigherOrder(a.getType(), Value.LONG); Value b = ValueLong.get(by).convertTo(type); a = a.convertTo(type).divide(b); return a; }
Expression l = le.get(i); Expression r = re.get(i); int type = Value.getHigherOrder(l.getType(), r.getType()); long prec = Math.max(l.getPrecision(), r.getPrecision()); int scale = Math.max(l.getScale(), r.getScale());
type = Value.getHigherOrder(c.getType(), type); prec = Math.max(c.getPrecision(), prec); scale = Math.max(c.getScale(), scale);
/** * Compare this value against another value using the specified compare * mode. * * @param v the other value * @param mode the compare mode * @return 0 if both values are equal, -1 if the other value is smaller, and * 1 otherwise */ public final int compareTo(Value v, CompareMode mode) { if (this == v) { return 0; } if (this == ValueNull.INSTANCE) { return v == ValueNull.INSTANCE ? 0 : -1; } else if (v == ValueNull.INSTANCE) { return 1; } if (getType() == v.getType()) { return compareSecure(v, mode); } int t2 = Value.getHigherOrder(getType(), v.getType()); return convertTo(t2).compareSecure(v.convertTo(t2), mode); }
int type = e.getType(); if (type != Value.UNKNOWN && type != Value.NULL) { t = Value.getHigherOrder(t, type); s = Math.max(s, e.getScale()); p = Math.max(p, e.getPrecision()); int type = then.getType(); if (type != Value.UNKNOWN && type != Value.NULL) { t = Value.getHigherOrder(t, type); s = Math.max(s, then.getScale()); p = Math.max(p, then.getPrecision()); int type = elsePart.getType(); if (type != Value.UNKNOWN && type != Value.NULL) { t = Value.getHigherOrder(t, type); s = Math.max(s, elsePart.getScale()); p = Math.max(p, elsePart.getPrecision()); t = Value.getHigherOrder(args[1].getType(), args[2].getType()); p = Math.max(args[1].getPrecision(), args[2].getPrecision()); d = Math.max(args[1].getDisplaySize(), args[2].getDisplaySize()); break; default: t = Value.getHigherOrder(args[1].getType(), args[2].getType()); break;
int dataType = Value.getHigherOrder(left.getType(), right.getType()); l = l.convertTo(dataType); r = r.convertTo(dataType);
r == Value.TIMESTAMP || r == Value.TIME) { if (opType == PLUS) { if (r != Value.getHigherOrder(l, r)) { DataType.getDataType(r).name); } else { dataType = Value.getHigherOrder(l, r); if (DataType.isStringType(dataType) && session.getDatabase().getMode().allowPlusForStringConcat) {