Пример #1
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     Net.Vpc.Upa.Expressions.Between o = new Net.Vpc.Upa.Expressions.Between();
     o.left = left.Copy();
     o.min  = min.Copy();
     o.max  = max.Copy();
     return(o);
 }
Пример #2
0
        public virtual Net.Vpc.Upa.Impl.Persistence.QueryExecutor Execute() /* throws Net.Vpc.Upa.Exceptions.UPAException */
        {
            int    c1       = 0;
            int    c2       = 0;
            string oldAlias = baseExpression.GetEntityAlias();

            if (oldAlias == null)
            {
                oldAlias = entity.GetName();
            }
            bool replaceThis = !"this".Equals(oldAlias);

            if (baseExpression.CountFields() > 0)
            {
                if (replaceThis)
                {
                    Net.Vpc.Upa.Impl.Uql.Util.UQLUtils.ReplaceThisVar(baseExpression, oldAlias, context.GetPersistenceUnit());
                }
                c1 = defaultPersistenceStore.CreateDefaultExecutor(baseExpression, parametersByName, parametersByIndex, updatable, defaultFieldFilter, context).Execute().GetResultCount();
            }
            if ((complexVals).Count > 0)
            {
                Net.Vpc.Upa.Expressions.Select q = new Net.Vpc.Upa.Expressions.Select();
                foreach (Net.Vpc.Upa.Field primaryField in entity.GetPrimaryFields())
                {
                    q.Field(primaryField.GetName());
                }
                foreach (Net.Vpc.Upa.Expressions.VarVal f in complexVals)
                {
                    Net.Vpc.Upa.Expressions.Expression fieldExpression = f.GetVal();
                    if (replaceThis)
                    {
                        Net.Vpc.Upa.Impl.Uql.Util.UQLUtils.ReplaceThisVar(fieldExpression, oldAlias, context.GetPersistenceUnit());
                    }
                    q.Field(fieldExpression, f.GetVar().GetName());
                }
                q.From(entity.GetName(), oldAlias);
                Net.Vpc.Upa.Expressions.Expression cond = baseExpression.GetCondition();
                q.SetWhere(cond == null ? null : cond.Copy());
                Net.Vpc.Upa.EntityBuilder eb = entity.GetBuilder();
                foreach (Net.Vpc.Upa.Record record in entity.GetPersistenceUnit().CreateQuery(q).GetRecordList())
                {
                    Net.Vpc.Upa.Expressions.Update u2 = new Net.Vpc.Upa.Expressions.Update();
                    u2.Entity(entityName);
                    foreach (Net.Vpc.Upa.Expressions.VarVal f in complexVals)
                    {
                        string fname = f.GetVar().GetName();
                        u2.Set(fname, record.GetObject <T>(fname));
                    }
                    Net.Vpc.Upa.Expressions.Expression exprId = eb.ObjectToIdExpression(record, oldAlias);
                    u2.Where(exprId);
                    c2 += defaultPersistenceStore.CreateDefaultExecutor(u2, parametersByName, parametersByIndex, updatable, defaultFieldFilter, context).Execute().GetResultCount();
                }
            }
            resultCount = System.Math.Max(c1, c2);
            return(this);
        }
Пример #3
0
 public virtual Net.Vpc.Upa.Expressions.Delete AddQuery(Net.Vpc.Upa.Expressions.Delete other)
 {
     if (other == null)
     {
         return(this);
     }
     if (other.entity != null)
     {
         entity = (Net.Vpc.Upa.Expressions.EntityName)other.entity.Copy();
     }
     if (other.entityAlias != null)
     {
         entityAlias = other.entityAlias;
     }
     other.condition = condition.Copy();
     return(this);
 }
Пример #4
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     Net.Vpc.Upa.Expressions.Var o = new Net.Vpc.Upa.Expressions.Var(applier == null ? null : applier.Copy(), name);
     return(o);
 }
Пример #5
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     Net.Vpc.Upa.Expressions.StrLen o = new Net.Vpc.Upa.Expressions.StrLen(expression.Copy());
     return(o);
 }
Пример #6
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     Net.Vpc.Upa.Impl.Extension.TreeEntityJoinCondition o = new Net.Vpc.Upa.Impl.Extension.TreeEntityJoinCondition(treeTable, var1, var2, expression.Copy());
     return(o);
 }
Пример #7
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     Net.Vpc.Upa.Expressions.Count o = new Net.Vpc.Upa.Expressions.Count(expression.Copy());
     return(o);
 }
Пример #8
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     Net.Vpc.Upa.Expressions.DateDiff o = new Net.Vpc.Upa.Expressions.DateDiff(type, start.Copy(), end.Copy());
     return(o);
 }
Пример #9
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     Net.Vpc.Upa.Expressions.InCollection o = new Net.Vpc.Upa.Expressions.InCollection(left.Copy());
     foreach (Net.Vpc.Upa.Expressions.Expression expression in right)
     {
         o.Add(expression);
     }
     return(o);
 }
Пример #10
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     return(new Net.Vpc.Upa.Expressions.Cast(@value.Copy(), targetType));
 }
Пример #11
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     Net.Vpc.Upa.Expressions.DateAdd o = new Net.Vpc.Upa.Expressions.DateAdd(type, count.Copy(), date.Copy());
     return(o);
 }
Пример #12
0
        public virtual Net.Vpc.Upa.Expressions.Expression CreateTargetListExpression(object currentInstance, string alias)
        {
            if (filter == null)
            {
                return(null);
            }
            System.Collections.Generic.Dictionary <string, object> v = new System.Collections.Generic.Dictionary <string, object>();
            v["this"] = currentInstance;
            if (Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(alias))
            {
                alias = GetTargetEntity().GetName();
            }
            string alias2 = alias;

            Net.Vpc.Upa.Expressions.Expression filter2 = GetPersistenceUnit().GetExpressionManager().SimplifyExpression(filter.Copy(), v);
            filter2.Visit(new Net.Vpc.Upa.Impl.Uql.Util.ThatExpressionReplacer(alias2));
            return(filter2);
        }
Пример #13
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     Net.Vpc.Upa.Expressions.IsHierarchyDescendent o = new Net.Vpc.Upa.Expressions.IsHierarchyDescendent(ancestorExpression.Copy(), childExpression.Copy(), (Net.Vpc.Upa.Expressions.EntityName)entityName.Copy());
     return(o);
 }
Пример #14
0
 public override Net.Vpc.Upa.Expressions.Expression Copy()
 {
     Net.Vpc.Upa.Expressions.DateTrunc o = new Net.Vpc.Upa.Expressions.DateTrunc(type, @value.Copy());
     return(o);
 }