Search in sources :

Example 21 with Value

use of org.gridgain.internal.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;
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) Value(org.h2.value.Value)

Example 22 with Value

use of org.gridgain.internal.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);
}
Also used : Value(org.h2.value.Value)

Example 23 with Value

use of org.gridgain.internal.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);
}
Also used : Value(org.h2.value.Value)

Example 24 with Value

use of org.gridgain.internal.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();
}
Also used : Value(org.h2.value.Value)

Example 25 with Value

use of org.gridgain.internal.h2.value.Value in project ignite by apache.

the class SqlSystemViewColumnCondition method forColumn.

/**
 * Parse condition for column.
 *
 * @param colIdx Column index.
 * @param start Start row values.
 * @param end End row values.
 */
public static SqlSystemViewColumnCondition forColumn(int colIdx, SearchRow start, SearchRow end) {
    boolean isEquality = false;
    boolean isRange = false;
    Value val = null;
    Value val2 = null;
    if (start != null && colIdx >= 0 && colIdx < start.getColumnCount())
        val = start.getValue(colIdx);
    if (end != null && colIdx >= 0 && colIdx < end.getColumnCount())
        val2 = end.getValue(colIdx);
    if (val != null && val2 != null) {
        if (val.equals(val2))
            isEquality = true;
        else
            isRange = true;
    } else if (val != null || val2 != null)
        isRange = true;
    return new SqlSystemViewColumnCondition(isEquality, isRange, val);
}
Also used : Value(org.h2.value.Value)

Aggregations

Value (org.h2.value.Value)751 Value (org.gridgain.internal.h2.value.Value)326 SQLException (java.sql.SQLException)186 DbException (org.h2.message.DbException)126 ValueBigint (org.h2.value.ValueBigint)100 DbException (org.gridgain.internal.h2.message.DbException)98 PreparedStatement (java.sql.PreparedStatement)78 ResultSet (java.sql.ResultSet)78 Column (org.h2.table.Column)65 Statement (java.sql.Statement)56 Expression (org.h2.expression.Expression)52 ValueSmallint (org.h2.value.ValueSmallint)52 Column (org.gridgain.internal.h2.table.Column)50 ValueString (org.gridgain.internal.h2.value.ValueString)49 Row (org.h2.result.Row)49 SearchRow (org.h2.result.SearchRow)49 ArrayList (java.util.ArrayList)44 JdbcStatement (org.gridgain.internal.h2.jdbc.JdbcStatement)42 Database (org.h2.engine.Database)42 BigDecimal (java.math.BigDecimal)41