예제 #1
0
        private static void ProcessMaximized(SemqContext context, Predicate predicate, ref Chainer query)
        {
            var ix1 = context.GetNewIndex();
            var ix2 = context.GetNewIndex();

            var self = predicate.Subject;

            context.SetIndex(self);

            var maximizedExpression = predicate.MaximizedExpression;

            var ordered = predicate.MaximizedType == MaximizationType.Min ?
                          new OrderedChainer(maximizedExpression, SortOrder.Asc) :
                          new OrderedChainer(maximizedExpression, SortOrder.Desc);

            var root = new InternalNode(self);

            query = root.GetDesigner()
                    .From(Designer.GetNewDesigner()
                          .From(((ISelect)query).Select(), root).As(ix1)
                          .OrderBy(ordered)
                          .Select().TopWithTies(predicate.MaximizedTop)
                          , root
                          ).As(ix2);

            self.ChangeIndex(ix2);
        }
예제 #2
0
파일: Crud.cs 프로젝트: amosvoron/querytalk
        internal static TransactionOptions GetTransactionScopeOption(Assembly client, Map map, ConnectBy connectBy)
        {
            var tempNode       = new InternalNode(map.ID);
            var connectionData = ConnectionManager.GetConnectionData(client, connectBy, tempNode, null);
            var scopeOption    = new TransactionOptions();

            scopeOption.Timeout        = TimeSpan.FromSeconds(connectionData.CommandTimeout);
            scopeOption.IsolationLevel = connectionData.MassDataOperationIsolationLevel.ToSystemEnum();
            return(scopeOption);
        }
예제 #3
0
        internal static DbNode ProcessIntermediate(SemqContext context, Predicate predicate, DbNode innerNode, Link link)
        {
            var intermediate = new InternalNode(link.Intermediate);

            context.AddNode(intermediate);
            intermediate.IsFinalizeable = predicate.IsFinalizeable;

            if (predicate.PredicateType == PredicateType.Quantified ||
                predicate.PredicateType == PredicateType.TopQuantified)
            {
                ((IPredicate)intermediate).AddPredicate(PredicateType.Cartesian, innerNode);
            }
            else
            {
                ((IPredicate)intermediate).AddPredicate(PredicateType.Existential, innerNode);
            }

            predicate.Sentence = (ISemantic)intermediate;

            return(intermediate);
        }
예제 #4
0
        private TableChainer _InjectJoinBy(DbNode node, string alias)
        {
            Chainer last = _tables[_tables.Count - 1];
            Chainer next;

            // skip .As
            if (last.Next is AliasAs)
            {
                last = last.Next;
            }

            // skip .On/.By
            if (last.Next is OnChainer || last.Next is ByChainer)
            {
                last = last.Next;
            }

            next = last.Next;

            // inject .Join.By
            var nodeToInsert = new InternalNode(node);

            // pass FK to support multiple relations in column graph - !
            ((IRelation)nodeToInsert).FK = node.GetFK();

            var by = ((ISemqJoin)last).Join(nodeToInsert).By(alias);

            by.SetNext(next);

            // add injected
            JoinChainer source = (JoinChainer)_tables[_tables.Count - 1];

            _targets.Add(source);
            ByJoin(source);

            return(source);
        }