From: Peter S. <sz...@us...> - 2004-04-30 08:34:33
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16725/NHibernate/Hql Modified Files: ClauseParser.cs FilterTranslator.cs FromParser.cs Log Message: Rereading HQL Index: ClauseParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/ClauseParser.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClauseParser.cs 15 Apr 2004 11:36:35 -0000 1.5 --- ClauseParser.cs 30 Apr 2004 08:34:25 -0000 1.6 *************** *** 17,21 **** private int parenCount = 0; ! public virtual void Token(string token, QueryTranslator q) { string lcToken = token.ToLower(); --- 17,22 ---- private int parenCount = 0; ! public virtual void Token(string token, QueryTranslator q) ! { string lcToken = token.ToLower(); *************** *** 29,33 **** } ! if (byExpected && !lcToken.Equals("by")) { throw new QueryException("BY expected after GROUP or ORDER: " + token); } --- 30,35 ---- } ! if (byExpected && !lcToken.Equals("by")) ! { throw new QueryException("BY expected after GROUP or ORDER: " + token); } *************** *** 39,43 **** if (lcToken.Equals("select")) { ! selectTokens = new ArrayList(); cacheSelectTokens = true; } --- 41,45 ---- if (lcToken.Equals("select")) { ! selectTokens = new ArrayList(); cacheSelectTokens = true; } Index: FromParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/FromParser.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FromParser.cs 19 Apr 2004 04:32:30 -0000 1.6 --- FromParser.cs 30 Apr 2004 08:34:25 -0000 1.7 *************** *** 24,29 **** private bool afterJoinType; private bool afterFetch; - //TODO: H2.0.3 does not have classPersister as a field... - private ILoadable classPersister; private JoinType joinType = JoinType.None; --- 24,27 ---- *************** *** 120,128 **** // AS construction - // if (classPersister!=null) - // { - // q.AddFromClass(token, classPersister); - // } - //else if (entityName!=null) if (entityName!=null) { --- 118,121 ---- *************** *** 137,142 **** expectingAs = false; entityName = null; - classPersister = null; - } else if (afterIn) --- 130,133 ---- *************** *** 146,149 **** --- 137,141 ---- if (alias==null) throw new QueryException("alias not specified for: " + token); + if (joinType!=JoinType.None) throw new QueryException("outer or full join must be followed by path expressions"); *************** *** 181,185 **** // starts with the name of a mapped class (new style) if (joinType!=JoinType.None) throw new QueryException("outer or full join must be followed by path expression"); - classPersister = p; entityName = q.CreateNameFor( p.MappedClass ); q.AddFromClass( entityName, p ); --- 173,176 ---- *************** *** 198,201 **** --- 189,193 ---- // force HQL style: from Person p inner join p.cars c + //if (joinType==JoinType.None) throw new QueryException("path expression must be preceded by full, left, right or inner join"); //allow ODMG OQL style: from Person p, p.cars c *************** *** 240,246 **** } ! public virtual void Start(QueryTranslator q) { entityName = null; - classPersister = null; alias = null; afterIn = false; --- 232,238 ---- } ! public virtual void Start(QueryTranslator q) ! { entityName = null; alias = null; afterIn = false; *************** *** 253,257 **** } ! public virtual void End(QueryTranslator q) { } } --- 245,250 ---- } ! public virtual void End(QueryTranslator q) ! { } } Index: FilterTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/FilterTranslator.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FilterTranslator.cs 15 Apr 2004 11:36:35 -0000 1.6 --- FilterTranslator.cs 30 Apr 2004 08:34:25 -0000 1.7 *************** *** 5,25 **** using System.Runtime.CompilerServices; ! namespace NHibernate.Hql { ! public class FilterTranslator : QueryTranslator { ! public FilterTranslator(Dialect.Dialect d) : base(d) { } ! /// <summary> Compile a filter. This method may be called multiple /// times. Subsequent invocations are no-ops. /// </summary> [MethodImpl(MethodImplOptions.Synchronized)] ! public void Compile(string collectionRole, ISessionFactoryImplementor factory, string queryString, IDictionary replacements, bool scalar) { ! if (!compiled) { ! this.factory = factory; // yick! ! AddFromCollection("this", collectionRole); ! base.Compile(factory, queryString, replacements, scalar); } } --- 5,29 ---- using System.Runtime.CompilerServices; ! namespace NHibernate.Hql ! { ! public class FilterTranslator : QueryTranslator ! { public FilterTranslator(Dialect.Dialect d) : base(d) { } ! /// <summary> ! /// Compile a filter. This method may be called multiple /// times. Subsequent invocations are no-ops. /// </summary> [MethodImpl(MethodImplOptions.Synchronized)] ! public void Compile(string collectionRole, ISessionFactoryImplementor factory, string queryString, IDictionary replacements, bool scalar) ! { ! if (!compiled) ! { ! this.factory = factory; // yick! ! AddFromCollection("this", collectionRole); ! base.Compile(factory, queryString, replacements, scalar); } } |