Package com.foundationdb.sql.types

Examples of com.foundationdb.sql.types.DataTypeDescriptor


            return expression;
        }

        ExpressionNode handleBooleanOperationExpression(BooleanOperationExpression expression) {
            boolean isNullable;
            DataTypeDescriptor sqLtype = expression.getSQLtype();
            isNullable = sqLtype == null // TODO if no SQL type, assume nullable for now
                    || sqLtype.isNullable(); // TODO rely on the previous type computer for now
            return boolExpr(expression, isNullable);
        }
View Full Code Here


            List<ResultField> fields = new ArrayList<>(nFields);

            for (int i= 0; i < nFields; i++) {
                ExpressionNode leftExpr = leftProject.getFields().get(i);
                ExpressionNode rightExpr= rightProject.getFields().get(i);
                DataTypeDescriptor leftType = leftExpr.getSQLtype();
                DataTypeDescriptor rightType = rightExpr.getSQLtype();

                DataTypeDescriptor projectType = null;
                // Case of SELECT null UNION SELECT null -> pick a type
                if (leftType == null && rightType == null)
                    projectType = null;
                else if (leftType == null)
                    projectType = rightType.getNullabilityType(true);
View Full Code Here

            }
        }


        private void castProjectField (CastExpression cast, Folder folder, ParametersSync parameterSync, TypesTranslator typesTranslator) {
            DataTypeDescriptor dtd = cast.getSQLtype();
            TInstance type = typesTranslator.typeForSQLType(dtd);
            cast.setPreptimeValue(new TPreptimeValue(type));
            TypeResolver.finishCast(cast, folder, parameterSync);
        }
View Full Code Here

            for (int i = 0; i < nparams; i++) {
                if (!instancesMap.isDefined(i)) continue;
                List<ExpressionNode> siblings = instancesMap.get(i);
                TPreptimeValue sharedTpv = siblings.get(0).getPreptimeValue();
                TInstance type = sharedTpv.type();
                DataTypeDescriptor sqlType = null;
                if (type == null) {
                    sqlType = siblings.get(0).getSQLtype();
                    if (sqlType != null)
                        type = typesTranslator.typeForSQLType(sqlType);
                    else
View Full Code Here

        PostgresType pgType = null;
        if (field.getAIScolumn() != null) {
            pgType = PostgresType.fromAIS(field.getAIScolumn());
        }
        else if (field.getSQLtype() != null) {
            DataTypeDescriptor sqlType = field.getSQLtype();
            TInstance type = field.getType();
            if (type == null)
                type = getTypesTranslator().typeForSQLType(sqlType);
            pgType = PostgresType.fromDerby(sqlType, type);
        }
View Full Code Here

            return expression;
        }

        if (equalForCast(targetInstance, type(expression)))
            return expression;
        DataTypeDescriptor sqlType = expression.getSQLtype();
        targetInstance = targetInstance.withNullable(sqlType == null || sqlType.isNullable());
        CastExpression castExpression =
            newCastExpression(expression, targetInstance);
        castExpression.setPreptimeValue(new TPreptimeValue(targetInstance));
        ExpressionNode result = finishCast(castExpression, folder, parametersSync);
        result = folder.foldConstants(result);
View Full Code Here

                                                   SchemaRulesContext rulesContext) {
        List<ExpressionNode> expressions = new ArrayList<>(values.getExpressions().size());
        for (List<ExpressionNode> row : values.getExpressions()) {
            expressions.add(row.get(0));
        }
        DataTypeDescriptor sqlType = new DataTypeDescriptor(TypeId.BOOLEAN_ID, true);
        TInstance type = rulesContext.getTypesTranslator().typeForSQLType(sqlType);
        InListCondition cond = new InListCondition(ccond.getLeft(), expressions,
                                                   sqlType, null, type);
        cond.setComparison(ccond);
        //cond.setPreptimeValue(new TPreptimeValue(AkBool.INSTANCE.instance(true)));
View Full Code Here

        ExpressionNode op2 = operands.get(1);
        ExpressionNode op3 = operands.get(2);
        ExpressionNode op4 = operands.get(3);
        if ((right.getType() != null) &&
            (right.getType().typeClass().jdbcType() != Types.DECIMAL)) {
            DataTypeDescriptor sqlType =
                new DataTypeDescriptor(TypeId.DECIMAL_ID, 10, 6, true, 12);
            TInstance type = queryGoal.getRulesContext()
                .getTypesTranslator().typeForSQLType(sqlType);
            right = new CastExpression(right, sqlType, right.getSQLsource(), type);
        }
        if (columnMatches(col1, op1) && columnMatches(col2, op2) &&
View Full Code Here

            return Types.LONGVARCHAR; // Not CLOB.
    }

    @Override
    protected DataTypeDescriptor dataTypeDescriptor(TInstance type) {
        return new DataTypeDescriptor(
                typeId, type.nullability(), type.attribute(StringAttribute.MAX_LENGTH),
                StringAttribute.characterTypeAttributes(type));
    }
View Full Code Here

            return Types.LONGVARBINARY; // Not BLOB.
    }

    @Override
    protected DataTypeDescriptor dataTypeDescriptor(TInstance type) {
        return new DataTypeDescriptor(typeId,
                                      type.nullability(),
                                      type.attribute(Attrs.LENGTH));
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.sql.types.DataTypeDescriptor

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.