use of org.h2.value.Value in project ignite by apache.
the class GridH2KeyValueRowOnheap method getValue0.
/**
* Get real column value.
*
* @param col Adjusted column index (without default columns).
* @return Value.
*/
private Value getValue0(int col) {
Value v = getCached(col);
if (v != null)
return v;
Object res = desc.columnValue(key.getObject(), val.getObject(), col);
if (res == null)
v = ValueNull.INSTANCE;
else {
try {
v = desc.wrap(res, desc.fieldType(col));
} catch (IgniteCheckedException e) {
throw DbException.convert(e);
}
}
setCached(col, v);
return v;
}
use of org.h2.value.Value in project ignite by apache.
the class InlineIndexHelperTest method getResBytes.
/**
*/
private boolean getResBytes(InlineIndexHelper ha, byte[] b1, byte[] b2) {
Value v1 = b1 == null ? ValueNull.INSTANCE : ValueBytes.get(b1);
Value v2 = b2 == null ? ValueNull.INSTANCE : ValueBytes.get(b2);
int c = v1.compareTypeSafe(v2, CompareMode.getInstance(null, 0));
return ha.canRelyOnCompare(c, v1, v2);
}
use of org.h2.value.Value in project ignite by apache.
the class InlineIndexHelperTest method getRes.
/**
*/
private boolean getRes(InlineIndexHelper ha, String s1, String s2) {
Value v1 = s1 == null ? ValueNull.INSTANCE : ValueString.get(s1);
Value v2 = s2 == null ? ValueNull.INSTANCE : ValueString.get(s2);
int c = v1.compareTypeSafe(v2, CompareMode.getInstance(null, 0));
return ha.canRelyOnCompare(c, v1, v2);
}
use of org.h2.value.Value in project ignite by apache.
the class H2Utils method convert.
/**
* Convert value to column's expected type by means of H2.
*
* @param val Source value.
* @param desc Row descriptor.
* @param type Expected column type to convert to.
* @return Converted object.
* @throws IgniteCheckedException if failed.
*/
public static Object convert(Object val, GridH2RowDescriptor desc, int type) throws IgniteCheckedException {
if (val == null)
return null;
int objType = DataType.getTypeFromClass(val.getClass());
if (objType == type)
return val;
Value h2Val = desc.wrap(val, objType);
return h2Val.convertTo(type).getObject();
}
use of org.h2.value.Value in project h2database by h2database.
the class Parser method readParameterIndex.
private void readParameterIndex() {
int i = parseIndex;
char[] chars = sqlCommandChars;
char c = chars[i++];
long number = c - '0';
while (true) {
c = chars[i];
if (c < '0' || c > '9') {
currentValue = ValueInt.get((int) number);
currentTokenType = VALUE;
currentToken = "0";
parseIndex = i;
break;
}
number = number * 10 + (c - '0');
if (number > Integer.MAX_VALUE) {
throw DbException.getInvalidValueException("parameter index", number);
}
i++;
}
}
Aggregations