GetJoinPart() public method

Gets the descriptor of the join at the given offset.
public GetJoinPart ( int offset ) : JoinPart
offset int The offset of the join descriptor to get.
return JoinPart
        private void PrintFromClause(FromClause fromClause)
        {
            if (fromClause == null || fromClause.IsEmpty)
                return;

            builder.Append("FROM ");

            var tables = fromClause.AllTables.ToList();
            for (int i = 0; i < tables.Count; i++) {
                var source = tables[i];

                JoinPart joinPart = null;

                if (i > 0) {
                    joinPart = fromClause.GetJoinPart(i - 1);
                    if (joinPart != null) {
                        if (joinPart.JoinType == JoinType.Inner) {
                            builder.Append(" INNER JOIN ");
                        } else if (joinPart.JoinType == JoinType.Right) {
                            builder.Append(" RIGHT OUTER JOIN ");
                        } else if (joinPart.JoinType == JoinType.Left) {
                            builder.Append(" LEFT OUTER JOIN ");
                        } else if (joinPart.JoinType == JoinType.Full) {
                            builder.Append(" FULL OUTER JOINT ");
                        }
                    }
                }

                if (source.IsSubQuery) {
                    builder.Append("(");
                    Visit(source.SubQuery);
                    builder.Append(")");
                } else {
                    builder.Append(source.Name);
                }

                if (!String.IsNullOrEmpty(source.Alias)) {
                    builder.Append(" AS ");
                    builder.Append(source.Alias);
                }

                if (i < tables.Count - 1) {
                    if (joinPart == null) {
                        builder.Append(", ");
                    } else {
                        builder.Append(" ON ");
                        Visit(joinPart.OnExpression);
                    }
                }
            }
        }
示例#2
0
        private void PrintFromClause(FromClause fromClause)
        {
            if (fromClause == null || fromClause.IsEmpty)
            {
                return;
            }

            builder.Append("FROM ");

            var tables = fromClause.AllTables.ToList();

            for (int i = 0; i < tables.Count; i++)
            {
                var source = tables[i];

                JoinPart joinPart = null;

                if (i > 0)
                {
                    joinPart = fromClause.GetJoinPart(i - 1);
                    if (joinPart != null)
                    {
                        if (joinPart.JoinType == JoinType.Inner)
                        {
                            builder.Append(" INNER JOIN ");
                        }
                        else if (joinPart.JoinType == JoinType.Right)
                        {
                            builder.Append(" RIGHT OUTER JOIN ");
                        }
                        else if (joinPart.JoinType == JoinType.Left)
                        {
                            builder.Append(" LEFT OUTER JOIN ");
                        }
                        else if (joinPart.JoinType == JoinType.Full)
                        {
                            builder.Append(" FULL OUTER JOINT ");
                        }
                    }
                }

                if (source.IsSubQuery)
                {
                    builder.Append("(");
                    Visit(source.SubQuery);
                    builder.Append(")");
                }
                else
                {
                    builder.Append(source.Name);
                }

                if (!String.IsNullOrEmpty(source.Alias))
                {
                    builder.Append(" AS ");
                    builder.Append(source.Alias);
                }

                if (i < tables.Count - 1)
                {
                    if (joinPart == null)
                    {
                        builder.Append(", ");
                    }
                    else
                    {
                        builder.Append(" ON ");
                        Visit(joinPart.OnExpression);
                    }
                }
            }
        }