I managed to implement this. 2014-10-10 1:09 GMT+13:00 Alexander Zaytsev <[email protected]>:
> Does it finally work? > > 2014-10-10 0:52 GMT+13:00 Stanley Goldman <[email protected]>: > >> Hey Alexander and Oskar, >> >> Thanks for the help. >> >> Oskar's comments pointed me in the right direction, so I've made some >> progress. >> >> I just pushed my latest changes: >> https://github.com/StanleyGoldman/nhibernate-core/compare/NH-3035 >> >> Alexander, please check my changes before you do any work. >> >> I found the partial class HqlSqlWalker and added the >> IsOrderExpressionResultVariableRef() >> and handleResultVariableRef() >> >> in HqlSqlWalker.g I at least understand how to use >> HandleResultVariableRef() now, I just don't know what value I'm supposed to >> send to IsOrderExpressionResultVariableRef(). >> >> orderExpr >>> : { IsOrderExpressionResultVariableRef(_t) }? resultVariableRef >>> | expr >>> ; >>> >>> resultVariableRef! >>> : i=identifier { >>> // Create a RESULT_VARIABLE_REF node instead of an IDENT node. >>> ResultVariableRefNode resultVariableRef = (IASTNode) >>> adaptor.Create(RESULT_VARIABLE_REF, i.Text); >>> HandleResultVariableRef(resultVariableRef); >>> } >>> ; >>> >> >> Thanks for all the help so far. >> -Stan >> >> >> On Thursday, October 9, 2014 6:56:24 AM UTC-4, Alexander Zaytsev wrote: >> >>> Hi Stanley, >>> >>> I'm trying to fix the HqlSqlWalker.g, I'll comback later. >>> >>> But it seems that you've forgot to port following code to >>> HqlSqlWalker.cs: >>> + protected boolean isOrderExpressionResultVariableRef(AST >>> orderExpressionNode) throws SemanticException { >>> + // ORDER BY is not supported in a subquery >>> + // TODO: should an exception be thrown if an ORDER BY is in a >>> subquery? >>> + if ( ! isSubQuery() && >>> + orderExpressionNode.getType() == IDENT && >>> + selectExpressionsByResultVariable.containsKey( >>> orderExpressionNode.getText() ) ) { >>> + return true; >>> + } >>> + return false; >>> + } >>> + >>> + protected void handleResultVariableRef(AST resultVariableRef) throws >>> SemanticException { >>> + if ( isSubQuery() ) { >>> + throw new SemanticException( >>> + "References to result variables in subqueries are not supported." >>> + ); >>> + } >>> + ( ( ResultVariableRefNode ) resultVariableRef ).setSelectExpression( >>> + selectExpressionsByResultVariable.get( resultVariableRef.getText() ) >>> + ); >>> + } >>> + >>> >>> Best Regards, >>> Alexander >>> >>> 2014-10-09 10:38 GMT+13:00 Oskar Berggren <[email protected]>: >>> >>>> In SqlASTFactory.java there is (addition in the diff): >>>> + case RESULT_VARIABLE_REF: >>>> + return ResultVariableRefNode.class; >>>> >>>> >>>> A class with otherwise similar code in NHibernate seems to be >>>> HqlSqlWalkerTreeAdaptor. >>>> >>>> /Oskar >>>> >>>> >>>> 2014-10-08 20:45 GMT+02:00 Stanley Goldman <[email protected]>: >>>> >>>> Still looking for some help here. I will code most of whatever needs to >>>>> be fixed. >>>>> I just need some direction from someone who knows this better than I >>>>> do. >>>>> >>>>> >>>>> On Sunday, October 5, 2014 10:39:30 AM UTC-4, Stanley Goldman wrote: >>>>>> >>>>>> Hello, >>>>>> >>>>>> I'm developing for Orchard CMS and I came across this bug. >>>>>> >>>>>> https://nhibernate.jira.com/browse/NH-3035 >>>>>> >>>>>> Which I see has been fixed in Hibernate. >>>>>> >>>>>> https://hibernate.atlassian.net/browse/HHH-892 >>>>>> >>>>>> https://github.com/davidmc24/hibernate-core/commit/13699d792 >>>>>> b9f69fa13a1540617db71109aa9688e >>>>>> >>>>>> At first I felt confident that I would be able to work these changes >>>>>> in. >>>>>> I feel i successfully ported the unit tests and most of the object >>>>>> changes. >>>>>> I'm hoping I can get some help with the n-hibernate equivalents in >>>>>> HqlSqlGenerator.g and SqlGenerator.g >>>>>> >>>>>> https://github.com/StanleyGoldman/nhibernate-core/compare/NH-3035 >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> For instance this chunk >>>>>> >>>>>> orderExprs >>>>>>> : expr ( ASCENDING | DESCENDING )? (orderExprs)? >>>>>>> : orderExpr ( ASCENDING | DESCENDING )? (orderExprs)? >>>>>>> ; >>>>>>> >>>>>>> orderExpr >>>>>>> : { isOrderExpressionResultVariableRef( _t ) }? >>>>>>> resultVariableRef >>>>>>> | expr >>>>>>> ; >>>>>>> >>>>>>> resultVariableRef! >>>>>>> : i:identifier { >>>>>>> // Create a RESULT_VARIABLE_REF node instead of an IDENT >>>>>>> node. >>>>>>> #resultVariableRef = #([RESULT_VARIABLE_REF, i.getText()]); >>>>>>> handleResultVariableRef(#resultVariableRef); >>>>>>> } >>>>>>> ; >>>>>>> >>>>>> >>>>>> I'm not sure how to create a new instance of ResultVariableRefNode >>>>>> equivalent to the one above. >>>>>> >>>>>> orderExprs >>>>>>> : orderExpr ( ASCENDING | DESCENDING )? (orderExprs)? >>>>>>> ; >>>>>>> >>>>>>> orderExpr >>>>>>> : { IsOrderExpressionResultVariableRef( _t ) }? >>>>>>> resultVariableRef >>>>>>> | expr >>>>>>> ; >>>>>>> >>>>>>> resultVariableRef! >>>>>>> : i=identifier { >>>>>>> // Create a RESULT_VARIABLE_REF node instead of an IDENT >>>>>>> node. >>>>>>> var resultVariableRef = new ResultVariableRefNode(); >>>>>>> HandleResultVariableRef(resultVariableRef); >>>>>>> } >>>>>>> ; >>>>>>> >>>>>> >>>>>> Thanks in advance for any help. >>>>>> >>>>>> -Stanley >>>>>> >>>>> -- >>>>> >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "nhibernate-development" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "nhibernate-development" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> >> --- >> You received this message because you are subscribed to the Google Groups >> "nhibernate-development" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- You received this message because you are subscribed to the Google Groups "nhibernate-development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
