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);
        }
        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);
        }