protected internal virtual void AppendJoins(Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledSelect o, System.Text.StringBuilder sb, Net.Vpc.Upa.Persistence.EntityExecutionContext context, Net.Vpc.Upa.Impl.Persistence.SQLManager sqlManager, Net.Vpc.Upa.Impl.Uql.ExpressionDeclarationList declarations) { for (int i = 0; i < o.CountJoins(); i++) { Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledJoinCriteria e = o.GetJoin(i); // String _valueString = sqlManager.getSQL(e.getEntity(), context, declarations); string _aliasString = e.GetEntityAlias(); string _joinKey = "Inner Join"; switch (e.GetJoinType()) { case Net.Vpc.Upa.Expressions.JoinType.INNER_JOIN: _joinKey = "Inner Join"; break; case Net.Vpc.Upa.Expressions.JoinType.FULL_JOIN: _joinKey = "Full Join"; break; case Net.Vpc.Upa.Expressions.JoinType.LEFT_JOIN: _joinKey = "Left Join"; break; case Net.Vpc.Upa.Expressions.JoinType.RIGHT_JOIN: _joinKey = "Right Join"; break; case Net.Vpc.Upa.Expressions.JoinType.CROSS_JOIN: _joinKey = "Cross Join"; break; } sb.Append(" ").Append(_joinKey).Append(" ").Append(sqlManager.GetSQL(e.GetEntity(), context, declarations)); if (_aliasString != null) { Net.Vpc.Upa.Persistence.PersistenceStore store = context.GetPersistenceStore(); // String goodAlias = store.getPersistenceName(, PersistenceNameType.ALIAS); sb.Append(" ").Append(sqlManager.GetSQL(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar(_aliasString), context, declarations)); } if (e.GetCondition() != null && e.GetCondition().IsValid()) { sb.Append(" On ").Append(sqlManager.GetSQL(e.GetCondition(), context, declarations)); } } }
public virtual Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledSelect AddQuery(Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledSelect other) { if (other == null) { return(this); } if (other.queryEntity != null) { From((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledNameOrSelect)(other.queryEntity.Copy()), other.queryEntityAlias); } for (int i = 0; i < (other.joinsTables).Count; i++) { Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledJoinCriteria j = other.GetJoin(i); Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledNameOrSelect ee = j.GetEntity(); Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression cc = j.GetCondition(); Join(j.GetJoinType(), ee == null ? null : (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledNameOrSelect)ee.Copy(), j.GetEntityAlias(), cc == null ? null : cc.Copy()); } foreach (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledQueryField field in other.fields) { Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression ee = field.GetExpression(); AddField(ee == null ? null : ee.Copy(), field.GetAlias()); } foreach (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledOrderItem compiledOrderItem in other.order.GetItems()) { Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression ee = compiledOrderItem.GetExpression(); OrderBy(ee == null ? null : ee.Copy(), compiledOrderItem.IsAsc()); } foreach (Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression e in other.groupByExpressions) { GroupBy(e == null ? null : e.Copy()); } AddWhere(other.where == null ? null : other.where.Copy()); AddHaving(other.having == null ? null : other.having.Copy()); Invalidate(); return(this); }