Package com.foundationdb.server.types.value

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


                    expression.with(bindings);
                expression.evaluate();
                ValueSource columnValue = expression.resultValue();
                if (columnValue.isNull())
                    isNull = true;
                Value valueCopy = new Value(columnValue.getType());
                ValueTargets.copyFrom(columnValue, valueCopy);
                AkCollator collator = (collators != null) ? collators.get(i) : null;
                hashKey ^= ValueSources.hash(valueCopy, collator);
                values.add(valueCopy);
                i++;
View Full Code Here


    private boolean  checkOverlay (int index, Object object) {
        if (object == null) {
            pOverlays[index] = null;
            return false;
        } else if (pOverlays[index] == null) {
            pOverlays[index] = new Value(underlying.rowType().typeAt(index));
            return true;
        }
        return true;
    }
View Full Code Here

        throw new UnsupportedOperationException();
    }

    @Override
    public ValueSource uncheckedValue(int i) {
        Value value = values.get(i);
        if (!value.hasAnyValue())
            throw new IllegalStateException("value at index " + i + " was never set");
        return value;
    }
View Full Code Here

        this.rowType = rowType;
        int nfields = rowType.nFields();
        values = new ArrayList<>(nfields);
        for (int i = 0; i < nfields; ++i) {
            TInstance type = rowType.typeAt(i);
            values.add(new Value(type));
        }
    }
View Full Code Here

     * needs to keep a copy of the underlying value.
     *
     */
    @Override
    public void setValue(int index, ValueSource value) {
        Value holder = null;
        if (bindings.isDefined(index)) {
            holder = (Value)bindings.get(index);
            if (holder.getType() != value.getType())
                holder = null;
        }
        if (holder == null) {
            holder = new Value(value.getType());
            bindings.set(index, holder);
        }
        ValueTargets.copyFrom(value, holder);
    }
View Full Code Here

        return new IndexBound(row(itemIidIndexRowType, iid, null, null), new SetColumnSelector(0));
    }

    private Row intRow(RowType rowType, int x)
    {
        List<TPreparedExpression> pExpressions = Arrays.<TPreparedExpression>asList(new TPreparedLiteral(MNumeric.INT.instance(false), new Value(MNumeric.INT.instance(false), x)));
        return new ExpressionRow(rowType, queryContext, queryBindings, pExpressions);
    }
View Full Code Here

            RowStream stream = new RowStream();
            TableSource tableSource = createAs.getTableSource();
            TableRowType rowType = tableRowType(tableSource);
            com.foundationdb.server.types.value.Value values[] = new com.foundationdb.server.types.value.Value[rowType.nFields()];
            for(int i = 0; i < rowType.nFields(); i++){
                values[i] = new Value(rowType.typeAt(i));
                values[i].putNull();
            }
            ValuesRow valuesRow = new ValuesRow(rowType, values);
            Collection<BindableRow> bindableRows = new ArrayList<>();
            bindableRows.add(BindableRow.of(valuesRow));
View Full Code Here

                        seqNode.getSequenceName().getSchemaName() :
                            rulesContext.getDefaultSchemaName();
                // Extract the (potential) schema name as the first parameter
                TInstance schemaType = typesTranslator.typeForString(schema);
                params.add(new ConstantExpression(
                        new TPreptimeValue(new Value(schemaType, schema))));
                // Extract the schema name as the second parameter
                String sequence = seqNode.getSequenceName().getTableName();
                TInstance sequenceType = typesTranslator.typeForString(sequence);
                params.add(new ConstantExpression(
                        new TPreptimeValue(new Value(sequenceType, sequence))));
               
                return new FunctionExpression ("nextval", params,
                        sqlType, valueNode, type);
            }
            else if (valueNode instanceof CurrentSequenceNode) {
                CurrentSequenceNode seqNode = (CurrentSequenceNode)valueNode;
                List<ExpressionNode> params = new ArrayList<>(2);

                String schema = seqNode.getSequenceName().hasSchema() ?
                        seqNode.getSequenceName().getSchemaName() :
                            rulesContext.getDefaultSchemaName();
                // Extract the (potential) schema name as the first parameter
                TInstance schemaType = typesTranslator.typeForString(schema);
                params.add(new ConstantExpression(
                        new TPreptimeValue(new Value(schemaType, schema))));
                // Extract the schema name as the second parameter
                String sequence = seqNode.getSequenceName().getTableName();
                TInstance sequenceType = typesTranslator.typeForString(sequence);
                params.add(new ConstantExpression(
                        new TPreptimeValue(new Value(sequenceType, sequence))));
               
                return new FunctionExpression ("currval", params,
                        sqlType, valueNode, type);
            }
            else if (valueNode instanceof DefaultNode) {
View Full Code Here

    public void testLimitFromBinding()
    {
        Operator plan = limit_Default(groupScan_Default(coi),
                                              0, false, 0, true);
        Cursor cursor = cursor(plan, queryContext, queryBindings);
        queryBindings.setValue(0, new Value(MNumeric.INT.instance(false), 2));
        Row[] expected = new Row[]{
            row(customerRowType, 1L, "northbridge"),
            row(customerRowType, 2L, "foundation"),
        };
        compareRows(expected, cursor);
View Full Code Here

    public void testLimitFromBadBinding()
    {
        Operator plan = limit_Default(groupScan_Default(coi),
                                              0, false, 0, true);
        Cursor cursor = cursor(plan, queryContext, queryBindings);
        queryBindings.setValue(0, new Value(MNumeric.INT.instance(false), -1));
        Row[] expected = new Row[]{
        };
        compareRows(expected, cursor);
    }
View Full Code Here

TOP

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

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.