예제 #1
0
        private void DoPathExpression(string token, QueryTranslator q)
        {
            Preprocess(token, q);

            StringTokenizer tokens = new StringTokenizer(token, ".", true);

            pathExpressionParser.Start(q);
            foreach (string tok in tokens)
            {
                pathExpressionParser.Token(tok, q);
            }
            pathExpressionParser.End(q);

            if (pathExpressionParser.IsCollectionValued)
            {
                OpenExpression(q, string.Empty);
                AppendToken(q, pathExpressionParser.GetCollectionSubquery());
                CloseExpression(q, string.Empty);
                // this is ugly here, but needed because its a subquery
                q.AddQuerySpace(q.GetCollectionPersister(pathExpressionParser.CollectionRole).CollectionSpace);
            }
            else
            {
                if (pathExpressionParser.IsExpectingCollectionIndex)
                {
                    expectingIndex++;
                }
                else
                {
                    AddJoin(pathExpressionParser.WhereJoin, q);
                    AppendToken(q, pathExpressionParser.WhereColumn);
                }
            }
        }