private int Search(HqlValues a, HqlValues b)
        {
            object oa     = null;
            object ob     = null;
            int    result = 0;

            for (int i = 0; i < _orderOfSortFields.Count; ++i)
            {
                object item = _orderOfSortFields[i];
                if (!(item is HqlCompareToken))
                {
                    throw new Exception("Unknown object in SortFields");
                }

                HqlCompareToken ctoken = (HqlCompareToken)item;
                if (!GetValues(b, a, ctoken, ref ob, ref oa) && !GetValues(a, b, ctoken, ref oa, ref ob))
                {
                    continue;
                }

                int ret = HqlCompareToken.CompareTo(oa, ob);
                if (ret != 0)
                {
                    result = ret;
                    break;
                }
            }

            return(result);
        }
        static private int?CompareHqlValues(HqlValues x, HqlValues y, HqlToken item, HqlToken compareType)
        {
            object ox;
            object oy;

            if (!x.HasValue(item, out ox))
            {
                return(null);
            }
            if (!y.HasValue(item, out oy))
            {
                throw new Exception("Error! How come it doesn't have it in Y?");
            }

            int ret = HqlCompareToken.CompareTo(ox, oy);

            //switch (compareType)
            //{
            //    // TODO
            //}
            return(ret);
        }