Exemplo n.º 1
0
 /// <summary>
 /// Locate the select clause that is part of this select statement.
 /// Note, that this might return null as derived select clauses (i.e., no
 /// select clause at the HQL-level) get generated much later than when we
 /// get created; thus it depends upon lifecycle.
 /// </summary>
 /// <returns>Our select clause, or null.</returns>
 public SelectClause GetSelectClause()
 {
     // Due to the complexity in initializing the SelectClause, do not generate one here.
     // If it is not found; simply return null...
     //
     // Also, do not cache since it gets generated well after we are created.
     return(( SelectClause )ASTUtil.FindTypeInChildren(this, HqlSqlWalker.SELECT_CLAUSE));
 }
Exemplo n.º 2
0
        public OrderByClause GetOrderByClause()
        {
            if (_orderByClause == null)
            {
                _orderByClause = LocateOrderByClause();

                // if there is no order by, make one
                if (_orderByClause == null)
                {
                    Log.Debug("getOrderByClause() : Creating a new ORDER BY clause");
                    _orderByClause = (OrderByClause)Walker.ASTFactory.CreateNode(HqlSqlWalker.ORDER, "ORDER");

                    // Find the WHERE; if there is no WHERE, find the FROM...
                    IASTNode prevSibling = ASTUtil.FindTypeInChildren(this, HqlSqlWalker.WHERE) ??
                                           ASTUtil.FindTypeInChildren(this, HqlSqlWalker.FROM);

                    // Now, inject the newly built ORDER BY into the tree
                    prevSibling.AddSibling(_orderByClause);
                }
            }
            return(_orderByClause);
        }
Exemplo n.º 3
0
 private OrderByClause LocateOrderByClause()
 {
     return((OrderByClause)ASTUtil.FindTypeInChildren(this, HqlSqlWalker.ORDER));
 }