Package com.foundationdb.server.types.value

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


                    nvalid++;
                    if (nvalid == nfields)
                        // Once we have copies of all fields, don't need row any more.
                        currentRow = null;
                }
                ValueSource inputValue = inputRow.value(i);
                if (!eqP(currentValues[i], inputValue, rowType().typeAt(i))) {
                    ValueTargets.copyFrom(inputValue, currentValues[i]);
                    nvalid = i + 1;
                    if (i < nfields - 1)
                        // Might need later fields.
View Full Code Here


                            }

                            @Override
                            public void evaluate() {
                                eval.evaluate();
                                ValueSource inSrc = eval.resultValue();
                                if (inSrc.isNull())
                                    value.putNull();
                                else
                                    value.putString(inSrc.getString(), null);
                            }

                            @Override
                            public void with(Row row) {
                                eval.with(row);
View Full Code Here

        return row.value(pos).isNull();
    }

    public static Long getLong(ValueRecord row, int field) {
        final Long result;
        ValueSource value = row.value(field);
        if (value.isNull()) {
            result = null;
        }
        else {
            switch (ValueSources.underlyingType(value)) {
            case INT_8:
                result = (long) value.getInt8();
                break;
            case INT_16:
                result = (long) value.getInt16();
                break;
            case UINT_16:
                result = (long) value.getUInt16();
                break;
            case INT_32:
                result = (long) value.getInt32();
                break;
            case INT_64:
                result = value.getInt64();
                break;
            default:
                throw new AssertionError(value);
            }
        }
View Full Code Here

                while (isInternalColumn(expected, actualPosition)) {
                    if(++expectedPosition == nFields)
                        return true;
                }
            }
            ValueSource expectedField = expected.value(expectedPosition);
            ValueSource actualField = actual.value(actualPosition);
            TInstance expectedType = expected.rowType().typeAt(expectedPosition);
            TInstance actualType = actual.rowType().typeAt(actualPosition);
            assertEquals("expected type", expectedType.typeClass(), actualType.typeClass());
            int c = TClass.compare(expectedType, expectedField, actualType, actualField);
            if (c != 0)
View Full Code Here

        @Override
        public void open() {
            String currentSchema = context.getCurrentSchema();
            String schemaName, tableName;
            ValueSource value = valueNotNull(0);
            if (value == null)
                schemaName = currentSchema;
            else
                schemaName = value.getString();
            tableName = bindings.getValue(1).getString();
            TableName groupName = new TableName(schemaName, tableName);
            Group group = context.getStore().schema().ais().getGroup(groupName);
            if (group == null)
                throw new NoSuchGroupException(groupName);
View Full Code Here

            messagesSent = 0;
        }

        protected ValueSource valueNotNull(int index) {
            try {
                ValueSource value = bindings.getValue(index);
                if (value.isNull())
                    return null;
                else
                    return value;
            }
            catch (BindingNotSetException ex) {
View Full Code Here

    @Override
    protected void doEvaluate(TExecutionContext context, LazyList<? extends ValueSource> inputs, ValueTarget output)
    {
        int unit = inputs.get(0).getInt32();
       
        ValueSource date1 = inputs.get(1);
        ValueSource date2 = inputs.get(2);
       
        switch(unit)
        {
            case TernaryOperatorNode.YEAR_INTERVAL:
            case TernaryOperatorNode.QUARTER_INTERVAL:
View Full Code Here

                        savedCurrent = true;
                    }
                    JDBCResultSet nested = (JDBCResultSet)resultSet.getObject(col);
                    holderStack.push(new ResultSetHolder(nested, colName, rowHolder.rsHolder.depth + 1));
                } else {
                    ValueSource valueSource = row.value(col - 1);
                    JsonRowWriter.writeValue(colName, valueSource, appender, !begun, options);
                    begun = true;
                }
            }
        } catch(SQLException e) {
View Full Code Here

    }

    protected NewRow finishRow() {
        for (int i = 0; i < constColumns.length; i++) {
            int columnIndex = constColumns[i];
            ValueSource value = values[columnIndex];
            rowCreator.put(value, row, columnIndex);
        }
        for (int i = 0; i < evalColumns.length; i++) {
            int columnIndex = evalColumns[i];
            TEvaluatableExpression expr = expressions[i];
            expr.evaluate();
            ValueSource value = expr.resultValue();
            rowCreator.put(value, row, columnIndex);
        }
        return row;
    }
View Full Code Here

    public TOverloadResult resultType() {
        return TOverloadResult.custom(new TCustomOverloadResult() {
            @Override
            public TInstance resultInstance(List<TPreptimeValue> inputs, TPreptimeContext context) {
                TPreptimeValue valueToRound = inputs.get(0);
                ValueSource roundToPVal = signatureStrategy.getScaleOperand(inputs);
                int precision, scale;
                if ((roundToPVal == null) || roundToPVal.isNull()) {
                    precision = 17;
                    int incomingScale = valueToRound.type().attribute(DecimalAttribute.SCALE);
                    if (incomingScale > 1)
                        precision += (incomingScale - 1);
                    scale = incomingScale;
                } else {
                    scale = roundToPVal.getInt32();

                    TInstance incomingInstance = valueToRound.type();
                    int incomingPrecision = incomingInstance.attribute(DecimalAttribute.PRECISION);
                    int incomingScale = incomingInstance.attribute(DecimalAttribute.SCALE);
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.