|
From: <fab...@us...> - 2009-04-23 06:03:29
|
Revision: 4206
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4206&view=rev
Author: fabiomaulo
Date: 2009-04-23 06:03:26 +0000 (Thu, 23 Apr 2009)
Log Message:
-----------
- Refactoring, bug fix of AST QT
- commented test not present in H3.2 and unneeded because wrong
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/BinaryLogicOperatorNode.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/SelectClause.cs
trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/SelectExpressionList.cs
trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs
Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/BinaryLogicOperatorNode.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/BinaryLogicOperatorNode.cs 2009-04-23 04:46:55 UTC (rev 4205)
+++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/BinaryLogicOperatorNode.cs 2009-04-23 06:03:26 UTC (rev 4206)
@@ -2,7 +2,6 @@
using Antlr.Runtime;
using NHibernate.Engine;
using NHibernate.Hql.Ast.ANTLR.Parameters;
-using NHibernate.Hql.Ast.ANTLR.Util;
using NHibernate.Type;
using NHibernate.Util;
Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/SelectClause.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/SelectClause.cs 2009-04-23 04:46:55 UTC (rev 4205)
+++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/SelectClause.cs 2009-04-23 06:03:26 UTC (rev 4206)
@@ -14,6 +14,7 @@
/// </summary>
public class SelectClause : SelectExpressionList
{
+ private const string JoinFetchWithoutOwnerExceptionMsg = "Query specified join fetching, but the owner of the fetched association was not present in the select list [{0}]";
private bool _prepared;
private bool _scalarSelect;
private List<FromElement> _collectionFromElements;
@@ -196,12 +197,9 @@
origin = fromElement.RealOrigin;
}
- if ( !_fromElementsForLoad.Contains( origin ) ) {
- throw new QueryException(
- "query specified join fetching, but the owner " +
- "of the fetched association was not present in the select list " +
- "[" + fromElement.GetDisplayText() + "]"
- );
+ if (!_fromElementsForLoad.Contains(origin))
+ {
+ throw new QueryException(string.Format(JoinFetchWithoutOwnerExceptionMsg, fromElement.GetDisplayText()));
}
IType type = fromElement.SelectType;
Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/SelectExpressionList.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/SelectExpressionList.cs 2009-04-23 04:46:55 UTC (rev 4205)
+++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/SelectExpressionList.cs 2009-04-23 06:03:26 UTC (rev 4206)
@@ -25,21 +25,21 @@
// are not select expressions (e.g. DISTINCT).
IASTNode firstChild = GetFirstSelectExpression();
IASTNode parent = this;
- List<ISelectExpression> list = new List<ISelectExpression>(parent.ChildCount);
+ var list = new List<ISelectExpression>(parent.ChildCount);
- for (int i = firstChild.ChildIndex; i < this.ChildCount; i++)
+ for (IASTNode n = firstChild; n != null; n = n.NextSibling)
{
- IASTNode n = GetChild(i);
-
- if ( n is ISelectExpression )
+ var se = n as ISelectExpression;
+ if (se != null)
{
- list.Add((ISelectExpression)n);
+ list.Add(se);
}
- else
+ else
{
- throw new InvalidOperationException( "Unexpected AST: " + n.GetType().Name + " " + new ASTPrinter().ShowAsString( n, "" ) );
+ throw new InvalidOperationException("Unexpected AST: " + n.GetType().FullName + " " + new ASTPrinter().ShowAsString(n, ""));
}
}
+
return list.ToArray();
}
Modified: trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs 2009-04-23 04:46:55 UTC (rev 4205)
+++ trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs 2009-04-23 06:03:26 UTC (rev 4206)
@@ -2468,9 +2468,14 @@
s.CreateQuery("select count(*) from Bar as bar where 1 in indices(bar.Baz.FooArray)").List();
s.CreateQuery(
"select count(*) from Bar as bar where '1' in (from bar.Component.Glarch.ProxyArray g where g.Name='foo')").List();
- s.CreateQuery(
- "select count(*) from Bar as bar where '1' in (from g in bar.Component.Glarch.ProxyArray.elements where g.Name='foo')")
- .List();
+
+ // The nex query is wrong and is not present in H3.2:
+ // The SQL result, from Classic parser, is the same of the previous query.
+ // The AST parser has some problem to parse 'from g in bar.Component.Glarch.ProxyArray'
+ // which should be parsed as 'from bar.Component.Glarch.ProxyArray g'
+ //s.CreateQuery(
+ // "select count(*) from Bar as bar where '1' in (from g in bar.Component.Glarch.ProxyArray.elements where g.Name='foo')")
+ // .List();
// TODO: figure out why this is throwing an ORA-1722 error
// probably the conversion ProxyArray.id (to_number ensuring a not null value)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|