Exemplo n.º 1
0
		public IStatement Translate()
		{
            if (_resultAst == null)
            {
                var nodes = new HqlSqlWalkerTreeNodeStream(_inputAst);

                var hqlSqlWalker = new HqlSqlWalker(_qti, _sfi, nodes, _tokenReplacements, _collectionRole);
                hqlSqlWalker.TreeAdaptor = new HqlSqlWalkerTreeAdaptor(hqlSqlWalker);

                try
                {
                    // Transform the tree.
                    _resultAst = (IStatement) hqlSqlWalker.statement().Tree;
                }
                finally
                {
                    hqlSqlWalker.ParseErrorHandler.ThrowQueryException();
                }
            }

		    return _resultAst;
		}
		public IStatement Translate()
		{
			if (_resultAst == null)
			{
				var nodes = new HqlSqlWalkerTreeNodeStream(_inputAst);
				nodes.TokenStream = _tokens;

				var hqlSqlWalker = new HqlSqlWalker(_qti, _sfi, nodes, _tokenReplacements, _collectionRole);
				hqlSqlWalker.TreeAdaptor = new HqlSqlWalkerTreeAdaptor(hqlSqlWalker);

            try
            {
               // Transform the tree.
               _resultAst = (IStatement) hqlSqlWalker.statement().Tree;

               /*
               if ( AST_LOG.isDebugEnabled() ) {
                  ASTPrinter printer = new ASTPrinter( SqlTokenTypes.class );
                  AST_LOG.debug( printer.showAsString( w.getAST(), "--- SQL AST ---" ) );
               }
               */
            }
            finally
            {
               hqlSqlWalker.ParseErrorHandler.ThrowQueryException();
            }
			}

			return _resultAst;
		}