Package com.foundationdb.server.types

Examples of com.foundationdb.server.types.TPreptimeValue


    }

    @Override
    public TPreptimeValue evaluateConstant(QueryContext queryContext) {
        if (type == null)
            return new TPreptimeValue(null, null);
        else
            return new TPreptimeValue(type, value);
    }
View Full Code Here


    private OverloadException overloadException(String name, List<? extends TPreptimeValue> inputs) {
        StringBuilder sb = new StringBuilder("no suitable overload found for ");
        sb.append(name).append('(');
        for (int i = 0, inputsSize = inputs.size(); i < inputsSize; i++) {
            TPreptimeValue tpv = inputs.get(i);
            if (tpv == null) {
                sb.append('?');
            }
            else {
                TInstance type = tpv.type();
                String className = (type == null)
                        ? "?"
                        : type.typeClass().name().toString();
                sb.append(className);
            }
View Full Code Here

            boolean requireExact = exactInputs.get(i);
            if ( (!requireExact) && scalarGroups.hasSameTypeAt(i)) {
                continue;
            }

            TPreptimeValue inputTpv = inputs.get(i);
            TInstance inputInstance = (inputTpv == null) ? null : inputTpv.type();
            // allow this input if...
            // ... input set takes ANY, and it isn't marked as an exact. If it's marked as an exact, we'll figure it
            // out later
            TInputSet inputSet = overload.inputSetAt(i);
            if ((!requireExact) && inputSet.targetType() == null) {
View Full Code Here

            for (int i = 0, size = inputs.size(); i < size; ++i) {
                if (overload.inputSetAt(i) != inputSet)
                    continue;
                if (notVararg && (i >= lastPositionalInput))
                    break;
                TPreptimeValue inputTpv = inputs.get(i);
                TInstance inputInstance = inputTpv.type();
                TInstance resultInstance;
                if (inputInstance != null) {
                    TClass inputTClass = inputInstance.typeClass();
                    if (inputTClass == targetTClass) {
                        resultInstance = inputInstance;
                    }
                    else {
                        TCast requiredCast = resolver.cast(inputTClass, targetTClass);
                        if (requiredCast == null)
                            throw new OverloadException("can't cast " + inputInstance + " to " + targetTClass);
                        inputInstance = requiredCast.preferredTarget(inputTpv);
                        resultInstance = inputInstance;
                    }
                }
                // no inputInstance = no type attributes
                else {
                    assert inputTpv.isNullable() : inputTpv;
                    // TODO: Generalize to e.g. instance(nullable) -> unknownInstance(nullable) ?
                    if(targetTClass instanceof TString) {
                        resultInstance = targetTClass.instance(Integer.MAX_VALUE, // no length would be preferable
                                                               StringFactory.DEFAULT_CHARSET_ID,
                                                               StringFactory.NULL_COLLATION_ID,
View Full Code Here

            for (int i = 0, size = inputs.size(); i < size; ++i) {
                if (overload.inputSetAt(i) != inputSet)
                    continue;
                if (notVararg && (i >= lastPositionalInput))
                    break;
                TPreptimeValue inputTpv = inputs.get(i);
                nullable |= inputTpv.isNullable();
                TInstance inputInstance = inputTpv.type();
                if (inputInstance == null) {
                    // unknown type, like a NULL literal or parameter
                    continue;
                }
                TClass inputClass = inputInstance.typeClass();
View Full Code Here

     */
    public static TPreptimeValue fromObject(Object object, TInstance type) {
        ValueSource value = valuefromObject(object, type);
        if (type == null) {
            if (value.getType() == null) {
                return new TPreptimeValue(value.getType());
            }
            return new TPreptimeValue(value);
        }
        return new TPreptimeValue (type,value);
    }
View Full Code Here

    }

    @Override
    public TPreptimeValue evaluateConstant(QueryContext queryContext) {
        TEvaluatableExpression eval = build();
        return new TPreptimeValue(type, eval.resultValue());
    }
View Full Code Here

                                            groupLookupPipelineQuantum);
        }
        else {
            // referencing WHERE fk IS NOT NULL AND...
            List<Column> referencingColumns = foreignKey.getReferencingColumns();
            TPreptimeValue emptyTPV = new TPreptimeValue();
            TValidatedScalar isNull = typesRegistryService.getScalarsResolver().get("IsNull", Collections.nCopies(1, emptyTPV)).getOverload();
            TValidatedScalar not = typesRegistryService.getScalarsResolver().get("NOT", Collections.nCopies(1, emptyTPV)).getOverload();
            TValidatedScalar and = typesRegistryService.getScalarsResolver().get("AND", Collections.nCopies(2, emptyTPV)).getOverload();
            TInstance boolType = AkBool.INSTANCE.instance(false);
            TPreparedExpression predicate = null;
View Full Code Here

public final class TPreparedParameter implements TPreparedExpression {

    @Override
    public TPreptimeValue evaluateConstant(QueryContext queryContext) {
        return new TPreptimeValue(type);
    }
View Full Code Here

       
        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

TOP

Related Classes of com.foundationdb.server.types.TPreptimeValue

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.