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);
        }
Beispiel #3
0
        protected virtual void EmitCreateViewStatement(CreateViewStatement statement)
        {
            Indent();
            AppendFormat("{0} {1} ", Keywords.Create, Keywords.View);
            if (!String.IsNullOrEmpty(statement.ViewSchema))
            {
                EmitIdentifier(statement.ViewSchema);
                Append(Keywords.Qualifier);
            }
            EmitIdentifier(statement.ViewName);
            NewLine();
            Indent();
            Append(Keywords.BeginGroup);
            IncreaseIndent();

            EmitExpression(statement.Expression);

            DecreaseIndent();
            NewLine();
            Indent();
            Append(Keywords.EndGroup);
        }
		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;
		}