Package com.foundationdb.server.types

Examples of com.foundationdb.server.types.TExecutionContext


            TInstance output = columns.get(fi).getType();
            values[ci] = new Value(output);
            // TODO: Only needed until every place gets type from
            // ValueTarget, when there can just be one
            // TExecutionContext wrapping the QueryContext.
            executionContexts[ci] = new TExecutionContext(null,
                                                          inputs, output, queryContext,
                                                          ErrorHandlingMode.WARN,
                                                          ErrorHandlingMode.WARN,
                                                          ErrorHandlingMode.WARN);
        }
        for (int fi = 0; fi < constColumns.length; fi++) {
            int ci = constColumns[fi];
            Column column = defaultColumns.get(fi);
            TInstance output = column.getType();
            Value value = new Value(output);
            TExecutionContext te = new TExecutionContext(null,
                                                         inputs, output, queryContext,
                                                         ErrorHandlingMode.WARN,
                                                         ErrorHandlingMode.WARN,
                                                         ErrorHandlingMode.WARN);
            vstring.putString(column.getDefaultValue(), null);
View Full Code Here


            TInstance targetInstance = targetClass.instance(sourceInstance == null || sourceInstance.nullability());
            tcast = context.getServer().typesRegistryService().getCastsResolver()
                .cast(sourceInstance, targetInstance);
            if (tcast == null)
                throw new NoSuchCastException(sourceInstance, targetInstance);
            tcontext = new TExecutionContext(Collections.singletonList(sourceInstance),
                                             targetInstance,
                                             context);
            target = new Value(targetInstance);
        }
View Full Code Here

            catch (IOException ex) {
                throw new AkibanInternalException("IO error reading from byte array", ex);
            }
        }
        TCast cast = typesRegistryService.getCastsResolver().cast(source.getType(), targetType);
        TExecutionContext context =
                new TExecutionContext(Collections.singletonList(source.getType()),
                        targetType,
                        queryContext);
        Value target = new Value(targetType);
        cast.evaluate(context, source, target);
        bindings.setValue(index, target);
View Full Code Here

                                                    (value instanceof java.sql.Timestamp) ?
                                                    ((java.sql.Timestamp)value).getNanos() : 0);
            TInstance targetType = type.getType();
            if (dateType.equals(targetType))
                return dateValue;
            TExecutionContext context =
                new TExecutionContext(Collections.singletonList(dateType),
                                      targetType, null);
            Value result = new Value(targetType);
            targetType.typeClass().fromObject(context, dateValue, result);
            return result;
        }
View Full Code Here

                source = bindings.getValue(parameterArgs[index]);
            }
            // Constants passed or parameters bound may not be of the
            // type specified in the signature.
            Value value = new Value(type);
            TExecutionContext executionContext =
                new TExecutionContext(null, null, type,
                                      context, null, null, null);
            tclass.fromObject(executionContext, source, value);
            return value;
        }
View Full Code Here

            TPreptimeValue pvalue = null;
            if (value == null)
                pvalue = ValueSources.fromObject(value, type);
            else
                pvalue = ValueSources.fromObject(value, (TInstance) null);
            TExecutionContext context = new TExecutionContext(null,
                                                              Collections.singletonList(pvalue.type()),
                    type,
                                                              null, null, null, null);
            Value pvalue2 = new Value(type);
            type.typeClass().fromObject(context, pvalue.value(), pvalue2);
View Full Code Here

        boolean targetsMatch = targetInstance.typeClass() == cast.targetClass();
        boolean sourcesMatch = source.type().typeClass() == cast.sourceClass();
        if ( (!targetsMatch) || (!sourcesMatch) )
            throw new IllegalArgumentException("cast <" + cast + "> not applicable to CAST(" + source + " AS " + targetInstance);

        TExecutionContext context = new TExecutionContext(
                null,
                Collections.singletonList(source.type()),
                targetInstance,
                null, // TODO
                ErrorHandlingMode.ERROR,
View Full Code Here

                } else {
                    TCast cast = type.typeClass().castFromVarchar();
                    if (cast != null) {
                        defaultValueSource = new Value(type);
                        TInstance valInst = typesTranslator.typeForString(defaultValue);
                        TExecutionContext executionContext = new TExecutionContext(Collections.singletonList(valInst),
                                                                                   type,
                                                                                   queryContext);
                        cast.evaluate(executionContext,
                                      new Value(valInst, defaultValue),
                                      defaultValueSource);
View Full Code Here

                    common = typesTranslator.typeForString();
               
                Value leftCasted = new Value(common);
                Value rightCasted = new Value(common);

                TExecutionContext execContext = new TExecutionContext(Arrays.asList(lTIns, rTIns), common, qc);
                casts.cast(lTIns, common).evaluate(execContext, leftSource, leftCasted);
                casts.cast(rTIns, common).evaluate(execContext, rightSource, rightCasted);
               
                return TClass.compare(leftCasted.getType(), leftCasted,
                                      rightCasted.getType(),rightCasted)
View Full Code Here

                    ValueSource value = bindings.getValue(limit());
                    if (value.isNull())
                        this.limitLeft = Integer.MAX_VALUE;
                    else {
                        TInstance type = MNumeric.INT.instance(true);
                        TExecutionContext executionContext =
                            new TExecutionContext(null, type, context);
                        Value ivalue = new Value(MNumeric.INT.instance(true));
                        MNumeric.INT.fromObject(executionContext, value, ivalue);
                        this.limitLeft = ivalue.getInt32();
                    }
                }
View Full Code Here

TOP

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

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.