public SelectStatement(ITagMapping tag): base(tag) { SelectList = new ExpressionCollection(); _IsDistinct = false; _SelectedAllColumns = false; _Limit = 0; _Offset = 0; _FromClause = new FromClause(); _WhereClause = new WhereClause(BinaryLogicOperator.And); _OrderByClause = new OrderByClause(this); }
public override void Visit(FromClause from_clause) { if (from_clause.Count > 0) base.Visit(from_clause); else _Query.Append(FROM).Append(DUAL); // DUAL is a dummy table ever existing }
private string GetParentTableName(FromClause from) { string parentTableName = string.Empty; Table t = from[from.Count - 1]; if (t.GetType() == typeof(TableSource)) parentTableName = t.TableAlias; else { if (t.GetType() == typeof(JoinedTable)) { while (t.GetType() == typeof(JoinedTable)) { t = ((JoinedTable)t).RigthTable; if (t.GetType() == typeof(TableSource)) break; } parentTableName = t.TableAlias; } } return parentTableName; }
public virtual void Visit(FromClause from_clause) { if(from_clause.Count > 0) _Query.Append(FROM); foreach(Table table in from_clause) { if (IsSelectStatement(table)) _Query.Append(OPENBRACE); table.Accept(this); if (IsSelectStatement(table)) { _Query.Append(CLOSEBRACE).Append(FormatTableAlias(table.TableAlias)).Append(SPACE); } if ( from_clause.IndexOf(table) != from_clause.Count - 1 ) _Query.Append(COMMA); } }