Package com.foundationdb.server.types.value

Examples of com.foundationdb.server.types.value.ValueSource


            new Rand(inputType, resultType)
            {
                @Override
                protected Random getRandom(LazyList<? extends ValueSource> inputs)
                {
                    ValueSource input = inputs.get(0);
                    if (input.isNull())
                        return new Random();
                    else
                        return new Random(inputs.get(0).getInt64());
                }
View Full Code Here


            loadCursor.openTopLevel();
            Row row;
            while ((row = loadCursor.next()) != null) {
                int h = 0;
                for (int f = 0; f < fields; f++) {
                    ValueSource valueSource = row.value(f);
                    h = h ^ ValueSources.hash(valueSource, collator(f));
                }
                filter.add(h);
                rows++;
            }
View Full Code Here

        StringBuilder buffer = new StringBuilder();
        AkibanAppender appender = AkibanAppender.of(buffer);
        buffer.append('(');
        boolean first = true;
        for (int i = 0, pEvalsSize = pEvaluatableExpressions.size(); i < pEvalsSize; i++) {
            ValueSource evaluation = value(i);
            TInstance type = rowType.typeAt(i);
            if (first) {
                first = false;
            } else {
                buffer.append(", ");
View Full Code Here

                if (!that.values.get(columnIndex).hasAnyValue()) {
                    return 1;
                } else if (!this.values.get(columnIndex).hasAnyValue()) {
                    return -1;
                } else {
                    ValueSource left = this.values.get(columnIndex);
                    ValueSource right = that.values.get(columnIndex);
                    TKeyComparable compare = registry.getKeyComparable(this.values.get(columnIndex).getType().typeClass(),
                            that.values.get(columnIndex).getType().typeClass());
                    if (compare != null) {
                        cmp =  compare.getComparison().compare(left.getType(), left, right.getType(), right);
                    } else {
                        cmp = TClass.compare(left.getType(), left, right.getType(), right);
                    }
                    if (cmp != 0) {
                        return cmp;
                    }
                }
View Full Code Here

        return null;
    }

    @Override
    public ValueSource uncheckedValue(int i) {
        ValueSource source;
        if (i < firstRowFields) {
            source = firstRow == null ? nullValue(i) : firstRow.value(i);
        } else {
            source = secondRow == null ? nullValue(i) : secondRow.value(i - rowOffset);
        }
View Full Code Here

    @Override
    public int compareTo(Row row, int leftStartIndex, int rightStartIndex, int fieldCount)
    {
        for (int i = 0; i < fieldCount; i++) {
            TInstance leftType = rowType().typeAt(leftStartIndex + i);
            ValueSource leftValue = value(leftStartIndex + i);
            TInstance rightType = ((Row)row).rowType().typeAt(rightStartIndex + i);
            ValueSource rightValue = row.value(rightStartIndex + i);
            int c = TClass.compare(leftType, leftValue, rightType, rightValue);
            if (c != 0) return (c < 0) ? -(i + 1) : (i + 1);
        }
        return 0;
    }
View Full Code Here

            catch (SQLException ex) {
                throw new ExternalRoutineInvocationException(((PostgresJavaRoutine)statement).getInvocation().getRoutineName(), ex);
            }
        }
        else {
            ValueSource source = encoder.valuefromObject(value, pgType);
            FormatOptions options = context.getServer().getFormatOptions();
            pgType.getType().formatAsJson(source, appender, options);
        }
    }
View Full Code Here

    private boolean wasNull;
    private CachedCast[] cachedCasts;

    protected ValueSource value(int index) {
        ValueSource value = getValue(index);
        wasNull = value.isNull();
        return value;
    }
View Full Code Here

    protected void setValue(int index, Object value, TInstance sourceType) {
        TInstance targetType = this.getType(index);
        if (sourceType == null) {
            sourceType = targetType;
        }
        ValueSource source = ValueSources.valuefromObject(value, sourceType);
        if (targetType != null)
            source = cachedCast(index, source, sourceType, targetType.typeClass());
        setValue(index, source);
    }
View Full Code Here

    public boolean wasNull() {
        return wasNull;
    }

    public String getString(int index) {
        ValueSource value = value(index);
        if (wasNull)
            return null;
        else
            return cachedCast(index, value, Types.VARCHAR).getString();
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.server.types.value.ValueSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.