Package com.foundationdb.server.types.value

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


    private Value output;
    private boolean needsDecoding = true;
   
    public PersistitKeyValueSource(TInstance type) {
        this.type = type;
        this.output = new Value(type);
    }
View Full Code Here


public class QueryBindingsTest
{
    @Test
    public void valueTest() {
        QueryBindings bindings = new SparseArrayQueryBindings();
        ValueSource value = new Value(MNumeric.INT.instance(false), 123);
        bindings.setValue(1, value);
        assertTrue(ValueSources.areEqual(value, bindings.getValue(1)));
    }
View Full Code Here

    }

    @Test(expected=BindingNotSetException.class)
    public void unboundValueTest() {
        QueryBindings bindings = new SparseArrayQueryBindings();
        ValueSource value = new Value(MNumeric.INT.instance(false), 0);
        bindings.setValue(0, value);
        bindings.getValue(1);
    }
View Full Code Here

    @Test
    public void inheritanceTest() {
        QueryBindings parent = new SparseArrayQueryBindings();
        assertEquals(0, parent.getDepth());
        ValueSource value = new Value(MNumeric.INT.instance(false), 1);
        parent.setValue(0, value);
        QueryBindings child = parent.createBindings();
        assertEquals(1, child.getDepth());
        assertTrue(parent.isAncestor(parent));
        assertTrue(child.isAncestor(parent));
View Full Code Here

        StoreAdapter adapter = newStoreAdapter(schema);
        QueryContext queryContext = queryContext(adapter);
        QueryBindings queryBindings = queryContext.createBindings();

        DirectObjectCursor cursor = plan.cursor(queryContext, queryBindings);
        queryBindings.setValue(0, new Value(MString.varcharFor("stat"), "stat"));
        queryBindings.setValue(1, new Value(MString.varcharFor("count=3"), "count=3"));
        queryBindings.setValue(2, new Value(MString.varcharFor("delay=2"), "delay=2"));
        queryBindings.setValue(3, new Value(MString.varcharFor("-a"), "-a"));
       
        int populatedResults = 0;
        int emptyResults = 0;
       
        cursor.open();
View Full Code Here

    private String string;
    private boolean expected;

    @Test
    public void checkParse() {
        ValueSource source = new Value(MString.varcharFor(string), string);
        Value target = new Value(AkBool.INSTANCE.instance(true));
        AkParsers.BOOLEAN.parse(null, source, target);
        Boolean actual = target.isNull() ? null : target.getBoolean();
        assertEquals(string, Boolean.valueOf(expected), actual);
    }
View Full Code Here

    private String input, expected;
    private int precision, scale;

    @Test
    public void checkParse() {
        ValueSource source = new Value(MString.varcharFor(input), input);
        Value target = new Value(MNumeric.DECIMAL.instance(precision, scale, true));
        TExecutionContext context =
            new TExecutionContext(null, Arrays.asList(source.getType()), target.getType(), null,
                                  ErrorHandlingMode.IGNORE, ErrorHandlingMode.IGNORE, ErrorHandlingMode.IGNORE);
        MParsers.DECIMAL.parse(context, source, target);
        BigDecimal actual = ((BigDecimalWrapper)target.getObject()).asBigDecimal();
        assertEquals(input, new BigDecimal(expected), actual);
    }
View Full Code Here

        QueryContext queryContext = new SimpleQueryContext(adapter);
       
        List<TPreparedExpression> pExpressions = new ArrayList<>(1);
      
        Value value = new Value(rowType.typeAt(columnNum));
        value.putNull();
        TPreptimeValue ptval = new TPreptimeValue (value.getType(), value);
        pExpressions.add(new TPreparedLiteral(ptval.type(), ptval.value()));
       
        ValuesRowType expectedType = schema.newValuesType(rowType.typeAt(columnNum));
       
        Row[] rows = objectToRows(expected, expectedType);
View Full Code Here

        PlanGenerator generator = context.table.getAIS().getCachedValue(extDataService, ExternalDataServiceImpl.CACHED_PLAN_GENERATOR);
        Operator plan = generator.generateAncestorPlan(context.table);
        Cursor cursor = null;
        try {

            Value value = new Value(context.typesTranslator.typeForString());
            int i = 0;
            for (Column column : context.table.getPrimaryKey().getColumns()) {
                // bug 1169995 - a null value in the PK won't match anything,
                // return null to force the insert.
                if (context.allValues.get(column) == null) {
                    return null;
                }
                value.putString(context.allValues.get(column), null);
                context.queryBindings.setValue(i, value);
                i++;
            }
            cursor = API.cursor(plan, context.queryContext, context.queryBindings);
            cursor.openTopLevel();
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.