Beispiel #1
0
		/// <summary>
		/// Returns the 'list' representation with some brackets around it for debugging.
		/// </summary>
		/// <param name="n">The tree.</param>
		/// <returns>The list representation of the tree.</returns>
		public static string GetDebugstring(IASTNode n)
		{
			StringBuilder buf = new StringBuilder();
			buf.Append("[ ");
			buf.Append((n == null) ? "{null}" : n.ToStringTree());
			buf.Append(" ]");
			return buf.ToString();
		}
Beispiel #2
0
        /// <summary>
        /// Returns the 'list' representation with some brackets around it for debugging.
        /// </summary>
        /// <param name="n">The tree.</param>
        /// <returns>The list representation of the tree.</returns>
        public static string GetDebugstring(IASTNode n)
        {
            StringBuilder buf = new StringBuilder();

            buf.Append("[ ");
            buf.Append((n == null) ? "{null}" : n.ToStringTree());
            buf.Append(" ]");
            return(buf.ToString());
        }
        private static string GetClassName(IASTNode querySource)
        {
            switch (querySource.Type)
            {
            case HqlSqlWalker.IDENT:
                return(querySource.Text);

            case HqlSqlWalker.DOT:
                return(BuildPath(querySource));

            default:
                // TODO
                throw new NotSupportedException($"{querySource.ToString()} {querySource.ToStringTree()}");
            }
        }
		public string ShowAsString(IASTNode ast, string header)
		{
            return ast.ToStringTree();
		}
        void ProcessQuery(IASTNode select, IASTNode query)
        {
            if (log.IsDebugEnabled())
            {
                log.Debug("processQuery() : {0}", query.ToStringTree());
            }

            try {
                QueryNode qn = ( QueryNode )query;

                // Was there an explicit select expression?
                bool explicitSelect = select != null && select.ChildCount > 0;

                if (!explicitSelect)
                {
                    // No explicit select expression; render the id and properties
                    // projection lists for every persister in the from clause into
                    // a single 'token node'.
                    //TODO: the only reason we need this stuff now is collection filters,
                    //      we should get rid of derived select clause completely!
                    CreateSelectClauseFromFromClause(qn);
                }
                else
                {
                    // Use the explicitly declared select expression; determine the
                    // return types indicated by each select token
                    UseSelectClause(select);
                }

                // After that, process the JOINs.
                // Invoke a delegate to do the work, as this is farily complex.
                JoinProcessor joinProcessor = new JoinProcessor(this);
                joinProcessor.ProcessJoins(qn);

                // Attach any mapping-defined "ORDER BY" fragments
                foreach (FromElement fromElement in qn.FromClause.GetProjectionList())
                {
                    if (fromElement.IsFetch && fromElement.QueryableCollection != null)
                    {
                        // Does the collection referenced by this FromElement
                        // specify an order-by attribute?  If so, attach it to
                        // the query's order-by
                        if (fromElement.QueryableCollection.HasOrdering)
                        {
                            string orderByFragment = fromElement
                                                     .QueryableCollection
                                                     .GetSQLOrderByString(fromElement.TableAlias);
                            qn.GetOrderByClause().AddOrderFragment(orderByFragment);
                        }
                        if (fromElement.QueryableCollection.HasManyToManyOrdering)
                        {
                            string orderByFragment = fromElement.QueryableCollection
                                                     .GetManyToManyOrderByString(fromElement.TableAlias);
                            qn.GetOrderByClause().AddOrderFragment(orderByFragment);
                        }
                    }
                }
            }
            finally
            {
                PopFromClause();
            }
        }
		void ProcessQuery(IASTNode select, IASTNode query)
		{
			if ( log.IsDebugEnabled ) {
				log.Debug( "processQuery() : " + query.ToStringTree() );
			}

			try {
				QueryNode qn = ( QueryNode ) query;

				// Was there an explicit select expression?
				bool explicitSelect = select != null && select.ChildCount > 0;

				if ( !explicitSelect ) {
					// No explicit select expression; render the id and properties
					// projection lists for every persister in the from clause into
					// a single 'token node'.
					//TODO: the only reason we need this stuff now is collection filters,
					//      we should get rid of derived select clause completely!
					CreateSelectClauseFromFromClause( qn );
				}
				else {
					// Use the explicitly declared select expression; determine the
					// return types indicated by each select token
					UseSelectClause( select );
				}

				// After that, process the JOINs.
				// Invoke a delegate to do the work, as this is farily complex.
				JoinProcessor joinProcessor = new JoinProcessor( this );
				joinProcessor.ProcessJoins( qn );

				// Attach any mapping-defined "ORDER BY" fragments
				foreach (FromElement fromElement in qn.FromClause.GetProjectionList())
				{
					if ( fromElement.IsFetch && fromElement.QueryableCollection != null ) 
					{
						// Does the collection referenced by this FromElement
						// specify an order-by attribute?  If so, attach it to
						// the query's order-by
						if ( fromElement.QueryableCollection.HasOrdering) 
						{
							string orderByFragment = fromElement
									.QueryableCollection
									.GetSQLOrderByString( fromElement.TableAlias );
							qn.GetOrderByClause().AddOrderFragment( orderByFragment );
						}
						if ( fromElement.QueryableCollection.HasManyToManyOrdering ) 
						{
							string orderByFragment = fromElement.QueryableCollection
									.GetManyToManyOrderByString( fromElement.TableAlias );
							qn.GetOrderByClause().AddOrderFragment( orderByFragment );
						}
					}
				}
			}
			finally
			{
				PopFromClause();
			}
		}
Beispiel #7
0
 public string ShowAsString(IASTNode ast, string header)
 {
     return(ast.ToStringTree());
 }
Beispiel #8
0
 public HqlExpression(HqlQuery node, System.Type type)
 {
     _node = node.AstNode;
     _type = type;
     _key = _node.ToStringTree();
 }