whereExpr() приватный Метод

private whereExpr ( ) : void
Результат void
Пример #1
0
        private void HandleWithFragment(FromElement fromElement, IASTNode hqlWithNode)
        {
            try
            {
                ITreeNodeStream old = input;
                input = new CommonTreeNodeStream(adaptor, hqlWithNode);

                IASTNode hqlSqlWithNode = (IASTNode)withClause().Tree;
                input = old;

                if (log.IsDebugEnabled())
                {
                    log.Debug("handleWithFragment() : {0}", _printer.ShowAsString(hqlSqlWithNode, "-- with clause --"));
                }
                WithClauseVisitor visitor   = new WithClauseVisitor(fromElement);
                NodeTraverser     traverser = new NodeTraverser(visitor);
                traverser.TraverseDepthFirst(hqlSqlWithNode);
                FromElement referencedFromElement = visitor.GetReferencedFromElement();
                if (referencedFromElement != fromElement)
                {
                    if (!referencedFromElement.IsEntityJoin() && !fromElement.IsEntityJoin())
                    {
                        throw new InvalidWithClauseException(
                                  "with-clause expressions did not reference from-clause element to which the with-clause was associated");
                    }
                }
                SqlGenerator sql = new SqlGenerator(_sessionFactoryHelper.Factory, new CommonTreeNodeStream(adaptor, hqlSqlWithNode.GetChild(0)));

                sql.whereExpr();

                var withClauseFragment = new SqlString("(", sql.GetSQL(), ")");
                fromElement.SetWithClauseFragment(visitor.GetJoinAlias(), withClauseFragment);
            }
            catch (SemanticException)
            {
                throw;
            }
            catch (InvalidWithClauseException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new SemanticException(e.Message, e);
            }
        }
Пример #2
0
        private void HandleWithFragment(FromElement fromElement, IASTNode hqlWithNode)
        {
            try
            {
                ITreeNodeStream old = input;
                input = new CommonTreeNodeStream(adaptor, hqlWithNode);

                IASTNode hqlSqlWithNode = (IASTNode)withClause().Tree;
                input = old;

                if (log.IsDebugEnabled())
                {
                    log.Debug("handleWithFragment() : {0}", _printer.ShowAsString(hqlSqlWithNode, "-- with clause --"));
                }
                WithClauseVisitor visitor   = new WithClauseVisitor(fromElement);
                NodeTraverser     traverser = new NodeTraverser(visitor);
                traverser.TraverseDepthFirst(hqlSqlWithNode);
                SqlGenerator sql = new SqlGenerator(_sessionFactoryHelper.Factory, new CommonTreeNodeStream(adaptor, hqlSqlWithNode.GetChild(0)));

                sql.whereExpr();

                fromElement.WithClauseFragment = new SqlString("(", sql.GetSQL(), ")");
            }
            catch (SemanticException)
            {
                throw;
            }
            catch (InvalidWithClauseException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new SemanticException(e.Message, e);
            }
        }
Пример #3
0
		private void HandleWithFragment(FromElement fromElement, IASTNode hqlWithNode)
		{
			try
			{
				ITreeNodeStream old = input;
				input = new CommonTreeNodeStream(adaptor, hqlWithNode);

				IASTNode hqlSqlWithNode = (IASTNode) withClause().Tree;
				input = old;

				if (log.IsDebugEnabled)
				{
					log.Debug("handleWithFragment() : " + _printer.ShowAsString(hqlSqlWithNode, "-- with clause --"));
				}
				WithClauseVisitor visitor = new WithClauseVisitor(fromElement);
				NodeTraverser traverser = new NodeTraverser(visitor);
				traverser.TraverseDepthFirst(hqlSqlWithNode);
				FromElement referencedFromElement = visitor.GetReferencedFromElement();
				if (referencedFromElement != fromElement)
				{
					throw new InvalidWithClauseException(
						"with-clause expressions did not reference from-clause element to which the with-clause was associated");
				}
				SqlGenerator sql = new SqlGenerator(_sessionFactoryHelper.Factory, new CommonTreeNodeStream(adaptor, hqlSqlWithNode.GetChild(0)));

				sql.whereExpr();

				var withClauseFragment = new SqlString("(", sql.GetSQL(), ")");
				fromElement.SetWithClauseFragment(visitor.GetJoinAlias(), withClauseFragment);
			}
			catch (SemanticException)
			{
				throw;
			}
			catch (InvalidWithClauseException)
			{
				throw;
			}
			catch (Exception e)
			{
				throw new SemanticException(e.Message);
			}
		}