Esempio n. 1
0
        internal SortQuery(SortQuery originalQuery) {
            this._qyInput = originalQuery._qyInput.Clone();
            int count = originalQuery._sortExpressions.Count;
            this._sortExpressions = new ArrayList(count);
            for (int i=0; i < count; i++) {
                IQuery query = originalQuery._sortExpressions[i] as IQuery;
                query = query.Clone();
                this._sortExpressions.Add(query);
            }
            this._comparers = new ArrayList(originalQuery._comparers);
            this._Results = new SortedList(new XPathComparer(_comparers));
            //            SetXsltContext(_context);


        }
Esempio n. 2
0
        public override void AddSort(object expr, IComparer comparer) {
            // sort makes sense only when we are dealing with a query that
            // returns a nodeset.
	    IQuery evalExpr;
             _allowSort = true;
            if (expr is String) {
                evalExpr = _builder.Build((String)expr, out _hasUnresolvedPrefix); // this will throw if expr is invalid
            }
            else if (expr is CompiledXpathExpr) {
		evalExpr = ((CompiledXpathExpr)expr).QueryTree;
	    }
            else {
                throw new XPathException(Res.Xp_BadQueryObject);
            }
            if (_sortQuery == null) {
                _sortQuery = new SortQuery(_compiledQuery);
                _compiledQuery = _sortQuery;
            }
            _sortQuery.AddSort(evalExpr, comparer);
        }