Ejemplo n.º 1
0
        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));
                }
            }
        }