Example #1
0
        private Model.Statement TranslateCondition(SQLTranslationContext context, string artifactName, string conditionName, ASTNode condition)
        {
            var result = new SQLModel.CreateViewStatement();

            result.ViewName   = context.GetExpressionObjectName(String.Format("{0}.{1}", artifactName, conditionName));
            result.Expression = SQLTranslationUtilities.EnsureSelectExpression(context.TranslateNode(condition));
            return(result);
        }
Example #2
0
        private Model.Statement TranslateExpressionDef(SQLTranslationContext context, string artifactName, ExpressionDef expressionDef)
        {
            var result = new SQLModel.CreateViewStatement();

            result.ViewName = context.GetExpressionObjectName(String.Format("{0}.{1}", artifactName, expressionDef.Name));
            var translatedExpression = context.TranslateNode(expressionDef.Expression);

            if (DataTypes.Equal(expressionDef.Expression.ResultType, DataTypes.Boolean))
            {
                translatedExpression = SQLTranslationUtilities.PromoteBooleanValuedExpression(translatedExpression);
            }

            result.Expression = SQLTranslationUtilities.EnsureSelectExpression(translatedExpression);
            return(result);
        }