Exemplo n.º 1
0
 public void FullOuterJoin <T>(SqlFragment parent, FullOuterJoin <T> fullOuterJoin) where T : IStatement
 {
     this.Script.LineAppend(TSqlKeyword.FULL_OUTER_JOIN);
     this.Script.AppendFragment(fullOuterJoin.Table, parent, this);
     this.Script.Append(TSqlKeyword.ON);
     this.Script.AppendFragment(fullOuterJoin.OnPredicate, parent, this);
 }
Exemplo n.º 2
0
        public Join <TDto> FullOuterJoin(string tableName, string tableAlias = null, string dbSchema = "dbo")
        {
            var fullOuterJoin = new FullOuterJoin <TDto>(_spry, this, new SprySelectTable <TDto>(_spry, tableName, tableAlias, dbSchema));

            _joins.Add(fullOuterJoin);
            return(fullOuterJoin);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Generates the text for a FullOuterJoin builder.
        /// </summary>
        /// <param name="item">The FullOuterJin builder to generate the text for.</param>
        protected internal override void VisitFullOuterJoin(FullOuterJoin item)
        {
            StringBuilder result = new StringBuilder("FULL ");

            if (options.VerboseOuterJoin)
            {
                result.Append("OUTER ");
            }
            result.Append("JOIN");
            visitFilteredJoin(item, result.ToString());
        }
Exemplo n.º 4
0
 protected override void SetupJoinConditions()
 {
     FullOuterJoin
     .Left("Id")
     .Right("Id");
 }
Exemplo n.º 5
0
        internal static bool TryParseSources(ScriptParser Parser, out SourceDefinition Source)
        {
            if (!TryParseSource(Parser, out Source))
            {
                return(false);
            }

            while (true)
            {
                string s = Parser.PeekNextToken().ToUpper();

                switch (s)
                {
                case ",":
                    Parser.NextToken();
                    if (!TryParseSource(Parser, out SourceDefinition Source2))
                    {
                        return(false);
                    }

                    Source = new CrossJoin(Source, Source2, Source.Start, Parser.Position - Source.Start, Parser.Expression);
                    break;

                case "INNER":
                case "JOIN":
                    Parser.NextToken();

                    if (s == "INNER")
                    {
                        if (Parser.NextToken().ToUpper() != "JOIN")
                        {
                            return(false);
                        }
                    }

                    if (!TryParseSource(Parser, out Source2))
                    {
                        return(false);
                    }

                    ScriptNode Conditions = ParseJoinConditions(Parser);
                    Source = new InnerJoin(Source, Source2, Conditions, Source.Start, Parser.Position - Source.Start, Parser.Expression);
                    break;

                case "LEFT":
                    Parser.NextToken();

                    switch (Parser.NextToken().ToUpper())
                    {
                    case "JOIN":
                        break;

                    case "OUTER":
                        if (Parser.NextToken().ToUpper() != "JOIN")
                        {
                            return(false);
                        }
                        break;

                    default:
                        return(false);
                    }

                    if (!TryParseSource(Parser, out Source2))
                    {
                        return(false);
                    }

                    Conditions = ParseJoinConditions(Parser);
                    Source     = new LeftOuterJoin(Source, Source2, Conditions, Source.Start, Parser.Position - Source.Start, Parser.Expression);
                    break;

                case "RIGHT":
                    Parser.NextToken();

                    switch (Parser.NextToken().ToUpper())
                    {
                    case "JOIN":
                        break;

                    case "OUTER":
                        if (Parser.NextToken().ToUpper() != "JOIN")
                        {
                            return(false);
                        }
                        break;

                    default:
                        return(false);
                    }

                    if (!TryParseSource(Parser, out Source2))
                    {
                        return(false);
                    }

                    Conditions = ParseJoinConditions(Parser);
                    Source     = new RightOuterJoin(Source, Source2, Conditions, Source.Start, Parser.Position - Source.Start, Parser.Expression);
                    break;

                case "FULL":
                    Parser.NextToken();

                    switch (Parser.NextToken().ToUpper())
                    {
                    case "JOIN":
                        break;

                    case "OUTER":
                        if (Parser.NextToken().ToUpper() != "JOIN")
                        {
                            return(false);
                        }
                        break;

                    default:
                        return(false);
                    }

                    if (!TryParseSource(Parser, out Source2))
                    {
                        return(false);
                    }

                    Conditions = ParseJoinConditions(Parser);
                    Source     = new FullOuterJoin(Source, Source2, Conditions, Source.Start, Parser.Position - Source.Start, Parser.Expression);
                    break;

                case "OUTER":
                    Parser.NextToken();

                    if (Parser.NextToken().ToUpper() != "JOIN")
                    {
                        return(false);
                    }

                    if (!TryParseSource(Parser, out Source2))
                    {
                        return(false);
                    }

                    Conditions = ParseJoinConditions(Parser);
                    Source     = new FullOuterJoin(Source, Source2, Conditions, Source.Start, Parser.Position - Source.Start, Parser.Expression);
                    break;

                default:
                    return(true);
                }
            }
        }
 private void AddJoin(FullOuterJoin item)
 {
     this.IsSingleSource = false;
     throw new NotSupportedException();
 }
 protected override void VisitFullOuterJoin(FullOuterJoin item)
 {
     this.AddJoin(item);
 }
 private void AddJoin(FullOuterJoin item)
 {
     throw new NotSupportedException();
 }