Пример #1
0
        protected virtual void BuildSetOperationCombinedStatementsPart(SqlStatement sqlStatement, ISqlCommandBuilder commandBuilder)
        {
            ArgumentUtility.CheckNotNull("sqlStatement", sqlStatement);
            ArgumentUtility.CheckNotNull("commandBuilder", commandBuilder);

            foreach (var combinedStatement in sqlStatement.SetOperationCombinedStatements)
            {
                switch (combinedStatement.SetOperation)
                {
                case SetOperation.Union:
                    commandBuilder.Append(" UNION (");
                    break;

                case SetOperation.UnionAll:
                    commandBuilder.Append(" UNION ALL (");
                    break;

                default:
                    throw new InvalidOperationException("Invalid enum value: " + combinedStatement.SetOperation);
                }

                _stage.GenerateTextForSqlStatement(commandBuilder, combinedStatement.SqlStatement);
                commandBuilder.Append(")");
            }
        }
Пример #2
0
 public virtual Expression VisitSqlSubStatementExpression(SqlSubStatementExpression expression)
 {
     _commandBuilder.Append("(");
     _stage.GenerateTextForSqlStatement(_commandBuilder, expression.SqlStatement);
     _commandBuilder.Append(")");
     return(expression);
 }
Пример #3
0
        public ITableInfo VisitSubStatementTableInfo(ResolvedSubStatementTableInfo tableInfo)
        {
            ArgumentUtility.CheckNotNull("tableInfo", tableInfo);

            _commandBuilder.Append("(");
            _stage.GenerateTextForSqlStatement(_commandBuilder, tableInfo.SqlStatement);
            _commandBuilder.Append(")");
            _commandBuilder.Append(" AS ");
            _commandBuilder.AppendIdentifier(tableInfo.TableAlias);

            return(tableInfo);
        }