You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <aye...@us...> - 2009-05-08 00:04:11
|
Revision: 4263 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4263&view=rev Author: ayenderahien Date: 2009-05-08 00:04:03 +0000 (Fri, 08 May 2009) Log Message: ----------- Log batch commands to NHibernate.SQL logger if it is enable as a single unit Better log output for byte arrays so they would go as hex strings Modified Paths: -------------- trunk/nhibernate/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs Modified: trunk/nhibernate/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs =================================================================== --- trunk/nhibernate/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs 2009-05-07 18:00:44 UTC (rev 4262) +++ trunk/nhibernate/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs 2009-05-08 00:04:03 UTC (rev 4263) @@ -66,7 +66,10 @@ Prepare(currentBatch.BatchCommand); if (log.IsDebugEnabled) { - log.Debug(currentBatchCommandsLog.ToString()); + if (Factory.Settings.SqlStatementLogger.IsDebugEnabled) + Factory.Settings.SqlStatementLogger.LogBatchCommand(currentBatchCommandsLog.ToString()); + else + log.Debug(currentBatchCommandsLog.ToString()); currentBatchCommandsLog = new StringBuilder(); } int rowsAffected = currentBatch.ExecuteNonQuery(); Modified: trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs =================================================================== --- trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs 2009-05-07 18:00:44 UTC (rev 4262) +++ trunk/nhibernate/src/NHibernate/AdoNet/Util/SqlStatementLogger.cs 2009-05-08 00:04:03 UTC (rev 4263) @@ -60,6 +60,11 @@ } } + public virtual void LogBatchCommand(string batchCommand) + { + log.Debug(batchCommand); + } + /// <summary> Log a IDbCommand. </summary> /// <param name="command">The SQL statement. </param> /// <param name="style">The requested formatting style. </param> @@ -104,16 +109,32 @@ { if(parameter.Value == null || DBNull.Value.Equals(parameter.Value)) { - return "null"; + return "NULL"; } - else if (IsStringType(parameter.DbType)) - { - return string.Concat("'", parameter.Value.ToString(), "'"); - } - return parameter.Value.ToString(); + if (IsStringType(parameter.DbType)) + { + return string.Concat("'", parameter.Value.ToString(), "'"); + } + var buffer = parameter.Value as byte[]; + if(buffer != null) + { + return GetBufferAsHexString(buffer); + } + return parameter.Value.ToString(); } - private static bool IsStringType(DbType dbType) + private static string GetBufferAsHexString(byte[] buffer) + { + var sb = new StringBuilder(buffer.Length*2 + 2); + sb.Append("0x"); + foreach (var b in buffer) + { + sb.Append(b.ToString("X2")); + } + return sb.ToString(); + } + + private static bool IsStringType(DbType dbType) { return DbType.String.Equals(dbType) || DbType.AnsiString.Equals(dbType) || DbType.AnsiStringFixedLength.Equals(dbType) || DbType.StringFixedLength.Equals(dbType); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-07 18:00:53
|
Revision: 4262 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4262&view=rev Author: fabiomaulo Date: 2009-05-07 18:00:44 +0000 (Thu, 07 May 2009) Log Message: ----------- - Minor adjust of exceptions - Test for "with" clause Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/InvalidWithClauseException.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QuerySyntaxException.cs trunk/nhibernate/src/NHibernate/QueryException.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/WithClauseFixture.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/InvalidWithClauseException.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/InvalidWithClauseException.cs 2009-05-07 15:04:34 UTC (rev 4261) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/InvalidWithClauseException.cs 2009-05-07 18:00:44 UTC (rev 4262) @@ -1,13 +1,16 @@ -namespace NHibernate.Hql.Ast.ANTLR +using System; +using System.Runtime.Serialization; + +namespace NHibernate.Hql.Ast.ANTLR { - class InvalidWithClauseException : QuerySyntaxException + [CLSCompliant(false)] + [Serializable] + public class InvalidWithClauseException : QuerySyntaxException { - public InvalidWithClauseException(string message) : base(message) - { - } + protected InvalidWithClauseException() {} + public InvalidWithClauseException(string message) : base(message) {} + public InvalidWithClauseException(string message, Exception inner) : base(message, inner) {} - public InvalidWithClauseException(string message, string hql) : base(message, hql) - { - } + protected InvalidWithClauseException(SerializationInfo info, StreamingContext context) : base(info, context) {} } -} +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QuerySyntaxException.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QuerySyntaxException.cs 2009-05-07 15:04:34 UTC (rev 4261) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QuerySyntaxException.cs 2009-05-07 18:00:44 UTC (rev 4262) @@ -1,20 +1,21 @@ using System; +using System.Runtime.Serialization; using Antlr.Runtime; namespace NHibernate.Hql.Ast.ANTLR { [CLSCompliant(false)] + [Serializable] public class QuerySyntaxException : QueryException { - public QuerySyntaxException(string message) : base(message) - { - } + protected QuerySyntaxException() {} + public QuerySyntaxException(string message, string hql) : base(message, hql) {} - public QuerySyntaxException(string message, string hql) - : base(message, hql) - { - } + public QuerySyntaxException(string message) : base(message) {} + public QuerySyntaxException(string message, Exception inner) : base(message, inner) {} + protected QuerySyntaxException(SerializationInfo info, StreamingContext context) : base(info, context) {} + public static QuerySyntaxException Convert(RecognitionException e) { return Convert(e, null); @@ -23,9 +24,9 @@ public static QuerySyntaxException Convert(RecognitionException e, string hql) { string positionInfo = e.Line > 0 && e.CharPositionInLine > 0 - ? " near line " + e.Line + ", column " + e.CharPositionInLine - : ""; + ? " near line " + e.Line + ", column " + e.CharPositionInLine + : ""; return new QuerySyntaxException(e.Message + positionInfo, hql); } } -} +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/QueryException.cs =================================================================== --- trunk/nhibernate/src/NHibernate/QueryException.cs 2009-05-07 15:04:34 UTC (rev 4261) +++ trunk/nhibernate/src/NHibernate/QueryException.cs 2009-05-07 18:00:44 UTC (rev 4262) @@ -12,6 +12,8 @@ { private string queryString; + protected QueryException() {} + /// <summary> /// Initializes a new instance of the <see cref="QueryException"/> class. /// </summary> Added: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/WithClauseFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/WithClauseFixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/WithClauseFixture.cs 2009-05-07 18:00:44 UTC (rev 4262) @@ -0,0 +1,159 @@ +using System.Collections; +using NHibernate.Hql.Ast.ANTLR; +using NUnit.Framework; + +namespace NHibernate.Test.HQL.Ast +{ + [TestFixture, Ignore("Not suported yet.")] + public class WithClauseFixture : BaseFixture + { + public ISession OpenNewSession() + { + return OpenSession(); + } + + [Test] + public void WithClauseFailsWithFetch() + { + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction txn = s.BeginTransaction(); + + Assert.Throws<HibernateException>( + () => + s.CreateQuery("from Animal a inner join fetch a.offspring as o with o.bodyWeight = :someLimit").SetDouble( + "someLimit", 1).List(), "ad-hoc on clause allowed with fetched association"); + + txn.Commit(); + s.Close(); + + data.Cleanup(); + } + + [Test] + public void InvalidWithSemantics() + { + ISession s = OpenSession(); + ITransaction txn = s.BeginTransaction(); + + // PROBLEM : f.bodyWeight is a reference to a column on the Animal table; however, the 'f' + // alias relates to the Human.friends collection which the aonther Human entity. The issue + // here is the way JoinSequence and Joinable (the persister) interact to generate the + // joins relating to the sublcass/superclass tables + Assert.Throws<InvalidWithClauseException>( + () => + s.CreateQuery("from Human h inner join h.friends as f with f.bodyWeight < :someLimit").SetDouble("someLimit", 1). + List()); + + Assert.Throws<InvalidWithClauseException>( + () => + s.CreateQuery( + "from Animal a inner join a.offspring o inner join o.mother as m inner join m.father as f with o.bodyWeight > 1"). + List()); + + Assert.Throws<InvalidWithClauseException>( + () => + s.CreateQuery("from Human h inner join h.offspring o with o.mother.father = :cousin").SetEntity("cousin", + s.Load<Human>(123L)) + .List()); + + txn.Commit(); + s.Close(); + } + + [Test] + public void WithClause() + { + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction txn = s.BeginTransaction(); + + // one-to-many + IList list = + s.CreateQuery("from Human h inner join h.offspring as o with o.bodyWeight < :someLimit").SetDouble("someLimit", 1). + List(); + Assert.That(list, Is.Empty, "ad-hoc on did not take effect"); + + // many-to-one + list = + s.CreateQuery("from Animal a inner join a.mother as m with m.bodyWeight < :someLimit").SetDouble("someLimit", 1). + List(); + Assert.That(list, Is.Empty, "ad-hoc on did not take effect"); + + // many-to-many + list = s.CreateQuery("from Human h inner join h.friends as f with f.nickName like 'bubba'").List(); + Assert.That(list, Is.Empty, "ad-hoc on did not take effect"); + + txn.Commit(); + s.Close(); + + data.Cleanup(); + } + + private class TestData + { + private readonly WithClauseFixture tc; + + public TestData(WithClauseFixture tc) + { + this.tc = tc; + } + + public void Prepare() + { + ISession session = tc.OpenNewSession(); + ITransaction txn = session.BeginTransaction(); + + var mother = new Human {BodyWeight = 10, Description = "mother"}; + + var father = new Human {BodyWeight = 15, Description = "father"}; + + var child1 = new Human {BodyWeight = 5, Description = "child1"}; + + var child2 = new Human {BodyWeight = 6, Description = "child2"}; + + var friend = new Human {BodyWeight = 20, Description = "friend"}; + + child1.Mother = mother; + child1.Father = father; + mother.AddOffspring(child1); + father.AddOffspring(child1); + + child2.Mother = mother; + child2.Father = father; + mother.AddOffspring(child2); + father.AddOffspring(child2); + + father.Friends = new[] {friend}; + + session.Save(mother); + session.Save(father); + session.Save(child1); + session.Save(child2); + session.Save(friend); + + txn.Commit(); + session.Close(); + } + + public void Cleanup() + { + ISession session = tc.OpenNewSession(); + ITransaction txn = session.BeginTransaction(); + session.CreateQuery("delete Animal where mother is not null").ExecuteUpdate(); + IList humansWithFriends = session.CreateQuery("from Human h where exists(from h.friends)").List(); + foreach (var friend in humansWithFriends) + { + session.Delete(friend); + } + session.CreateQuery("delete Animal").ExecuteUpdate(); + txn.Commit(); + session.Close(); + } + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-05-07 15:04:34 UTC (rev 4261) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-05-07 18:00:44 UTC (rev 4262) @@ -322,6 +322,7 @@ <Compile Include="HQL\Ast\TimestampVersioned.cs" /> <Compile Include="HQL\Ast\User.cs" /> <Compile Include="HQL\Ast\Vehicles.cs" /> + <Compile Include="HQL\Ast\WithClauseFixture.cs" /> <Compile Include="HQL\Ast\Zoo.cs" /> <Compile Include="HQL\BaseFunctionFixture.cs" /> <Compile Include="NHSpecificTest\Dates\TimeFixture.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-07 15:04:39
|
Revision: 4261 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4261&view=rev Author: fabiomaulo Date: 2009-05-07 15:04:34 +0000 (Thu, 07 May 2009) Log Message: ----------- End porting tests for INSERT executable HQL Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Removed Paths: ------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/FooBarCopy.hbm.xml Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-07 10:40:59 UTC (rev 4260) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-07 15:04:34 UTC (rev 4261) @@ -3,6 +3,8 @@ using System.Threading; using NHibernate.Dialect; using NHibernate.Hql.Ast.ANTLR; +using NHibernate.Id; +using NHibernate.Persister.Entity; using NUnit.Framework; namespace NHibernate.Test.HQL.Ast @@ -39,6 +41,7 @@ #endregion #region INSERTS + [Test] public void SimpleInsert() { @@ -61,6 +64,255 @@ data.Cleanup(); } + [Test] + public void InsertWithManyToOne() + { + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + s.CreateQuery( + "insert into Animal (description, bodyWeight, mother) select description, bodyWeight, mother from Human"). + ExecuteUpdate(); + + t.Commit(); + t = s.BeginTransaction(); + + t.Commit(); + s.Close(); + + data.Cleanup(); + } + + [Test] + public void InsertWithMismatchedTypes() + { + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + Assert.Throws<QueryException>( + () => s.CreateQuery("insert into Pickup (Owner, Vin, id) select id, Vin, Owner from Car").ExecuteUpdate(), + "mismatched types did not error"); + + t.Commit(); + t = s.BeginTransaction(); + + s.CreateQuery("delete Vehicle").ExecuteUpdate(); + + t.Commit(); + s.Close(); + + data.Cleanup(); + } + + [Test] + public void InsertIntoSuperclassPropertiesFails() + { + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + Assert.Throws<QueryException>( + () => s.CreateQuery("insert into Human (id, bodyWeight) select id, bodyWeight from Lizard").ExecuteUpdate(), + "superclass prop insertion did not error"); + + t.Commit(); + t = s.BeginTransaction(); + + s.CreateQuery("delete Animal where mother is not null").ExecuteUpdate(); + s.CreateQuery("delete Animal where father is not null").ExecuteUpdate(); + s.CreateQuery("delete Animal").ExecuteUpdate(); + + t.Commit(); + s.Close(); + + data.Cleanup(); + } + + [Test] + public void InsertAcrossMappedJoinFails() + { + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + Assert.Throws<QueryException>( + () => s.CreateQuery("insert into Joiner (name, joinedName) select vin, owner from Car").ExecuteUpdate(), + "mapped-join insertion did not error"); + + t.Commit(); + t = s.BeginTransaction(); + + s.CreateQuery("delete Joiner").ExecuteUpdate(); + s.CreateQuery("delete Vehicle").ExecuteUpdate(); + + t.Commit(); + s.Close(); + + data.Cleanup(); + } + + public void InsertWithGeneratedId() + { + // Make sure the env supports bulk inserts with generated ids... + IEntityPersister persister = sessions.GetEntityPersister(typeof (PettingZoo).FullName); + IIdentifierGenerator generator = persister.IdentifierGenerator; + if (!HqlSqlWalker.SupportsIdGenWithBulkInsertion(generator)) + { + return; + } + + // create a Zoo + var zoo = new Zoo {Name = "zoo"}; + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + s.Save(zoo); + t.Commit(); + s.Close(); + + s = OpenSession(); + t = s.BeginTransaction(); + int count = s.CreateQuery("insert into PettingZoo (name) select name from Zoo").ExecuteUpdate(); + t.Commit(); + s.Close(); + Assert.That(count, Is.EqualTo(1), "unexpected insertion count"); + + s = OpenSession(); + t = s.BeginTransaction(); + var pz = (PettingZoo) s.CreateQuery("from PettingZoo").UniqueResult(); + t.Commit(); + s.Close(); + + Assert.That(zoo.Name, Is.EqualTo(pz.Name)); + Assert.That(zoo.Id != pz.Id); + + s = OpenSession(); + t = s.BeginTransaction(); + s.CreateQuery("delete Zoo").ExecuteUpdate(); + t.Commit(); + s.Close(); + } + + [Test] + public void InsertWithGeneratedVersionAndId() + { + // Make sure the env supports bulk inserts with generated ids... + IEntityPersister persister = sessions.GetEntityPersister(typeof (IntegerVersioned).FullName); + IIdentifierGenerator generator = persister.IdentifierGenerator; + if (!HqlSqlWalker.SupportsIdGenWithBulkInsertion(generator)) + { + return; + } + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + var entity = new IntegerVersioned {Name = "int-vers"}; + s.Save(entity); + s.CreateQuery("select id, name, version from IntegerVersioned").List(); + t.Commit(); + s.Close(); + + long initialId = entity.Id; + int initialVersion = entity.Version; + + s = OpenSession(); + t = s.BeginTransaction(); + int count = s.CreateQuery("insert into IntegerVersioned ( name ) select name from IntegerVersioned").ExecuteUpdate(); + t.Commit(); + s.Close(); + + Assert.That(count, Is.EqualTo(1), "unexpected insertion count"); + + s = OpenSession(); + t = s.BeginTransaction(); + var created = + (IntegerVersioned) + s.CreateQuery("from IntegerVersioned where id <> :initialId").SetInt64("initialId", initialId).UniqueResult(); + t.Commit(); + s.Close(); + + Assert.That(created.Version, Is.EqualTo(initialVersion), "version was not seeded"); + + s = OpenSession(); + t = s.BeginTransaction(); + s.CreateQuery("delete IntegerVersioned").ExecuteUpdate(); + t.Commit(); + s.Close(); + } + + [Test] + public void InsertWithGeneratedTimestampVersion() + { + // Make sure the env supports bulk inserts with generated ids... + IEntityPersister persister = sessions.GetEntityPersister(typeof (TimestampVersioned).FullName); + IIdentifierGenerator generator = persister.IdentifierGenerator; + if (!HqlSqlWalker.SupportsIdGenWithBulkInsertion(generator)) + { + return; + } + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + var entity = new TimestampVersioned {Name = "int-vers"}; + s.Save(entity); + s.CreateQuery("select id, name, version from TimestampVersioned").List(); + t.Commit(); + s.Close(); + + long initialId = entity.Id; + //Date initialVersion = entity.getVersion(); + + s = OpenSession(); + t = s.BeginTransaction(); + int count = + s.CreateQuery("insert into TimestampVersioned ( name ) select name from TimestampVersioned").ExecuteUpdate(); + t.Commit(); + s.Close(); + + Assert.That(count, Is.EqualTo(1), "unexpected insertion count"); + + s = OpenSession(); + t = s.BeginTransaction(); + var created = + (TimestampVersioned) + s.CreateQuery("from TimestampVersioned where id <> :initialId").SetInt64("initialId", initialId).UniqueResult(); + t.Commit(); + s.Close(); + + Assert.That(created.Version, Is.GreaterThan(DateTime.Today)); + + s = OpenSession(); + t = s.BeginTransaction(); + s.CreateQuery("delete TimestampVersioned").ExecuteUpdate(); + t.Commit(); + s.Close(); + } + + [Test] + public void InsertWithSelectListUsingJoins() + { + // this is just checking parsing and syntax... + ISession s = OpenSession(); + s.BeginTransaction(); + s.CreateQuery( + "insert into Animal (description, bodyWeight) select h.description, h.bodyWeight from Human h where h.mother.mother is not null") + .ExecuteUpdate(); + s.CreateQuery("delete from Animal").ExecuteUpdate(); + s.Transaction.Commit(); + s.Close(); + } + #endregion #region UPDATES Deleted: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/FooBarCopy.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/FooBarCopy.hbm.xml 2009-05-07 10:40:59 UTC (rev 4260) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/FooBarCopy.hbm.xml 2009-05-07 15:04:34 UTC (rev 4261) @@ -1,140 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" - assembly="NHibernate.DomainModel" - namespace="NHibernate.DomainModel" - default-lazy="false"> - - <!-- a slightly modified copy of FooBar.hbm.xml from the legacy test package --> - - <class - name="Foo" - table="`foos`" - proxy="FooProxy" - discriminator-value="F" - batch-size="4" - dynamic-insert="true" - dynamic-update="true" - select-before-update="true"> - - <id name="key" type="string"> - <column name="`foo_idcolumnname123`" length="36"/> - <generator class="uuid.hex"> - <param name="seperator">:</param> - </generator> - </id> - - <discriminator column="`foo_subclass_1234`" type="character" force="true"/> - <version name="version"/> - - <many-to-one name="foo" class="Foo"> - <column name="foo" length="36" index="fbmtoidx"/> - </many-to-one> - - <property name="Long"> - <column name="long_" index="fbmtoidx" unique-key="abc" not-null="true"/> - </property> - <property name="Integer"> - <column name="`integer__`" unique-key="abc" not-null="true"/> - </property> - <property name="Float"> - <column name="float_" unique-key="abc" not-null="true" check="float_ > 0.0"/> - </property> - <property name="x"/> - <property name="Double" column="double_"/> - - <primitive-array name="bytes" table="foobytes"> - <key column="id"/> - <index column="i"/> - <element column="byte_" type="byte"/> - </primitive-array> - - <property name="Date" type="date" column="date_"/> - <property name="Timestamp" type="timestamp" column="timestamp_"/> - <property name="Boolean" column="boolean_"/> - <property name="Bool" column="bool_"/> - <property name="Null" column="null_"/> - <property name="Short" column="short_"/> - <property name="Char" column="char_"/> - <property name="Zero" column="zero_"/> - <property name="Int" column="int_"/> - <property name="String"> - <column name="string_" length="48" index="fbstridx"/> - </property> - <property name="Byte" column="byte_"/> - <property name="YesNo" type="yes_no"/> - <!-- - <property name="blob" type="org.hibernate.test.legacy.Foo$Struct" column="blobb_"/> - <property name="nullBlob" type="serializable"/> - <property name="binary" column="bin_"/> - --> - <property name="Locale" column="`localeayzabc123`" access="field.camelcase-underscore" type="locale"/> - - <property name="formula" formula="int_*2"/> - - <property name="Custom" type="NHibernate.DomainModel.DoubleStringType, NHibernate.DomainModel" access="field.camelcase"> - <column name="first_name" length="66"/> - <column name="surname" length="66"/> - </property> - - <component name="nullComponent"> - <property name="name" column="null_cmpnt_"/> - </component> - - <join table="jointable"> - <key column="fooid" on-delete="cascade"/> - <property name="joinedProp"/> - </join> - - <subclass - name="Trivial" - proxy="FooProxy" - discriminator-value="T"/> - - <subclass - name="Abstract" - proxy="AbstractProxy" - discriminator-value="null"> - <set name="abstracts" batch-size="2"> - <key column="abstract_id"/> - <one-to-many class="Abstract"/> - </set> - <property name="time" column="the_time"/> - - <subclass - name="Bar" - proxy="BarProxy" - discriminator-value="B"> - <property name="barString"> - <column name="bar_string" length="24"/> - </property> - <any name="object" meta-type="character" id-type="long" cascade="all"> - <meta-value value="O" class="One"/> - <meta-value value="M" class="Many"/> - <column name="clazz" length="100"/> - <column name="gen_id"/> - </any> - <join table="bar_join_table"> - <key column="bar_id"/> - <property name="name" column="name_name"/> - </join> - </subclass> - </subclass> - </class> - - <class name="One" table="one"> - <id name="key" column="one_key"> - <generator class="native" /> - </id> - <property name="x"/> - <property column="one_value" name="value"/> - </class> - - <class name="Many" table="many"> - <id name="key" column="many_key"> - <generator class="native" /> - </id> - <property name="x"/> - </class> - -</hibernate-mapping> - Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-05-07 10:40:59 UTC (rev 4260) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-05-07 15:04:34 UTC (rev 4261) @@ -42,6 +42,10 @@ <UseVSHostingProcess>false</UseVSHostingProcess> </PropertyGroup> <ItemGroup> + <Reference Include="Antlr3.Runtime, Version=3.1.0.39271, Culture=neutral, PublicKeyToken=3a9cab8f8d22bfb7, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\lib\net\2.0\Antlr3.Runtime.dll</HintPath> + </Reference> <Reference Include="Iesi.Collections, Version=1.0.0.1, Culture=neutral, PublicKeyToken=154fdcb44c4484fc"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\lib\net\2.0\Iesi.Collections.dll</HintPath> @@ -1750,7 +1754,6 @@ <EmbeddedResource Include="HQL\Ast\Animal.hbm.xml" /> <EmbeddedResource Include="HQL\Ast\BooleanLiteralEntity.hbm.xml" /> <EmbeddedResource Include="HQL\Ast\EntityWithCrazyCompositeKey.hbm.xml" /> - <Content Include="HQL\Ast\FooBarCopy.hbm.xml" /> <EmbeddedResource Include="HQL\Ast\KeyManyToOneEntity.hbm.xml" /> <EmbeddedResource Include="HQL\Ast\Multi.hbm.xml" /> <EmbeddedResource Include="HQL\Ast\SimpleEntityWithAssociation.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2009-05-07 10:41:11
|
Revision: 4260 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4260&view=rev Author: steverstrong Date: 2009-05-07 10:40:59 +0000 (Thu, 07 May 2009) Log Message: ----------- Fix for test HQL.Ast.BulkManipulation.SimpleInsert Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/SqlGenerator.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.g trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/SqlGenerator.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/SqlGenerator.cs 2009-05-07 05:49:01 UTC (rev 4259) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/SqlGenerator.cs 2009-05-07 10:40:59 UTC (rev 4260) @@ -1,6321 +1,6363 @@ -// $ANTLR 3.1.2 C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g 2009-05-05 16:13:08 - -// The variable 'variable' is assigned but its value is never used. -#pragma warning disable 168, 219 -// Unreachable code detected. -#pragma warning disable 162 -namespace NHibernate.Hql.Ast.ANTLR -{ - -using NHibernate.Hql.Ast.ANTLR.Tree; - - -using System; -using Antlr.Runtime; -using Antlr.Runtime.Tree;using IList = System.Collections.IList; -using ArrayList = System.Collections.ArrayList; -using Stack = Antlr.Runtime.Collections.StackList; - -using IDictionary = System.Collections.IDictionary; -using Hashtable = System.Collections.Hashtable; - -/** - * SQL Generator Tree Parser, providing SQL rendering of SQL ASTs produced by the previous phase, HqlSqlWalker. All - * syntax decoration such as extra spaces, lack of spaces, extra parens, etc. should be added by this class. - * <br> - * This grammar processes the HQL/SQL AST and produces an SQL string. The intent is to move dialect-specific - * code into a sub-class that will override some of the methods, just like the other two grammars in this system. - * @author Joshua Davis (jo...@hi...) - */ -public partial class SqlGenerator : TreeParser -{ - public static readonly string[] tokenNames = new string[] - { - "<invalid>", - "<EOR>", - "<DOWN>", - "<UP>", - "ALL", - "ANY", - "AND", - "AS", - "ASCENDING", - "AVG", - "BETWEEN", - "CLASS", - "COUNT", - "DELETE", - "DESCENDING", - "DOT", - "DISTINCT", - "ELEMENTS", - "ESCAPE", - "EXISTS", - "FALSE", - "FETCH", - "FROM", - "FULL", - "GROUP", - "HAVING", - "IN", - "INDICES", - "INNER", - "INSERT", - "INTO", - "IS", - "JOIN", - "LEFT", - "LIKE", - "MAX", - "MIN", - "NEW", - "NOT", - "NULL", - "OR", - "ORDER", - "OUTER", - "PROPERTIES", - "RIGHT", - "SELECT", - "SET", - "SOME", - "SUM", - "TRUE", - "UNION", - "UPDATE", - "VERSIONED", - "WHERE", - "LITERAL_by", - "CASE", - "END", - "ELSE", - "THEN", - "WHEN", - "ON", - "WITH", - "BOTH", - "EMPTY", - "LEADING", - "MEMBER", - "OBJECT", - "OF", - "TRAILING", - "AGGREGATE", - "ALIAS", - "CONSTRUCTOR", - "CASE2", - "EXPR_LIST", - "FILTER_ENTITY", - "IN_LIST", - "INDEX_OP", - "IS_NOT_NULL", - "IS_NULL", - "METHOD_CALL", - "NOT_BETWEEN", - "NOT_IN", - "NOT_LIKE", - "ORDER_ELEMENT", - "QUERY", - "RANGE", - "ROW_STAR", - "SELECT_FROM", - "UNARY_MINUS", - "UNARY_PLUS", - "VECTOR_EXPR", - "WEIRD_IDENT", - "CONSTANT", - "NUM_INT", - "NUM_DOUBLE", - "NUM_FLOAT", - "NUM_LONG", - "JAVA_CONSTANT", - "COMMA", - "EQ", - "OPEN", - "CLOSE", - "NE", - "SQL_NE", - "LT", - "GT", - "LE", - "GE", - "CONCAT", - "PLUS", - "MINUS", - "STAR", - "DIV", - "OPEN_BRACKET", - "CLOSE_BRACKET", - "COLON", - "PARAM", - "QUOTED_String", - "IDENT", - "ID_START_LETTER", - "ID_LETTER", - "ESCqs", - "WS", - "EXPONENT", - "FLOAT_SUFFIX", - "HEX_DIGIT", - "'ascending'", - "'descending'", - "FROM_FRAGMENT", - "IMPLIED_FROM", - "JOIN_FRAGMENT", - "SELECT_CLAUSE", - "LEFT_OUTER", - "RIGHT_OUTER", - "ALIAS_REF", - "PROPERTY_REF", - "SQL_TOKEN", - "SELECT_COLUMNS", - "SELECT_EXPR", - "THETA_JOINS", - "FILTERS", - "METHOD_NAME", - "NAMED_PARAM", - "BOGUS" - }; - - public const int SELECT_COLUMNS = 137; - public const int EXPONENT = 123; - public const int LT = 104; - public const int STAR = 111; - public const int FLOAT_SUFFIX = 124; - public const int FILTERS = 140; - public const int LITERAL_by = 54; - public const int PROPERTY_REF = 135; - public const int THETA_JOINS = 139; - public const int CASE = 55; - public const int NEW = 37; - public const int FILTER_ENTITY = 74; - public const int PARAM = 116; - public const int COUNT = 12; - public const int NOT = 38; - public const int EOF = -1; - public const int UNARY_PLUS = 89; - public const int QUOTED_String = 117; - public const int WEIRD_IDENT = 91; - public const int ESCqs = 121; - public const int OPEN_BRACKET = 113; - public const int FULL = 23; - public const int ORDER_ELEMENT = 83; - public const int INSERT = 29; - public const int ESCAPE = 18; - public const int IS_NULL = 78; - public const int FROM_FRAGMENT = 128; - public const int NAMED_PARAM = 142; - public const int BOTH = 62; - public const int SELECT_CLAUSE = 131; - public const int EQ = 99; - public const int VERSIONED = 52; - public const int SELECT = 45; - public const int INTO = 30; - public const int NE = 102; - public const int GE = 107; - public const int ID_LETTER = 120; - public const int CONCAT = 108; - public const int NULL = 39; - public const int ELSE = 57; - public const int SELECT_FROM = 87; - public const int TRAILING = 68; - public const int ON = 60; - public const int NUM_LONG = 96; - public const int NUM_DOUBLE = 94; - public const int UNARY_MINUS = 88; - public const int DELETE = 13; - public const int INDICES = 27; - public const int OF = 67; - public const int METHOD_CALL = 79; - public const int LEADING = 64; - public const int METHOD_NAME = 141; - public const int EMPTY = 63; - public const int T__126 = 126; - public const int GROUP = 24; - public const int T__127 = 127; - public const int WS = 122; - public const int FETCH = 21; - public const int VECTOR_EXPR = 90; - public const int NOT_IN = 81; - public const int SELECT_EXPR = 138; - public const int NUM_INT = 93; - public const int OR = 40; - public const int ALIAS = 70; - public const int JAVA_CONSTANT = 97; - public const int CONSTANT = 92; - public const int GT = 105; - public const int QUERY = 84; - public const int INDEX_OP = 76; - public const int NUM_FLOAT = 95; - public const int FROM = 22; - public const int END = 56; - public const int FALSE = 20; - public const int DISTINCT = 16; - public const int CONSTRUCTOR = 71; - public const int CLOSE_BRACKET = 114; - public const int WHERE = 53; - public const int CLASS = 11; - public const int MEMBER = 65; - public const int INNER = 28; - public const int PROPERTIES = 43; - public const int BOGUS = 143; - public const int ORDER = 41; - public const int MAX = 35; - public const int UPDATE = 51; - public const int JOIN_FRAGMENT = 130; - public const int SQL_NE = 103; - public const int AND = 6; - public const int SUM = 48; - public const int ASCENDING = 8; - public const int EXPR_LIST = 73; - public const int AS = 7; - public const int THEN = 58; - public const int IN = 26; - public const int OBJECT = 66; - public const int COMMA = 98; - public const int IS = 31; - public const int SQL_TOKEN = 136; - public const int AVG = 9; - public const int LEFT = 33; - public const int SOME = 47; - public const int ALL = 4; - public const int IMPLIED_FROM = 129; - public const int IDENT = 118; - public const int PLUS = 109; - public const int CASE2 = 72; - public const int EXISTS = 19; - public const int DOT = 15; - public const int LIKE = 34; - public const int WITH = 61; - public const int OUTER = 42; - public const int ID_START_LETTER = 119; - public const int LEFT_OUTER = 132; - public const int ROW_STAR = 86; - public const int NOT_LIKE = 82; - public const int HEX_DIGIT = 125; - public const int NOT_BETWEEN = 80; - public const int RANGE = 85; - public const int RIGHT_OUTER = 133; - public const int RIGHT = 44; - public const int SET = 46; - public const int HAVING = 25; - public const int MIN = 36; - public const int MINUS = 110; - public const int IS_NOT_NULL = 77; - public const int ELEMENTS = 17; - public const int TRUE = 49; - public const int JOIN = 32; - public const int UNION = 50; - public const int IN_LIST = 75; - public const int COLON = 115; - public const int OPEN = 100; - public const int ANY = 5; - public const int CLOSE = 101; - public const int WHEN = 59; - public const int ALIAS_REF = 134; - public const int DIV = 112; - public const int DESCENDING = 14; - public const int BETWEEN = 10; - public const int AGGREGATE = 69; - public const int LE = 106; - - // delegates - // delegators - - - - public SqlGenerator(ITreeNodeStream input) - : this(input, new RecognizerSharedState()) { - } - - public SqlGenerator(ITreeNodeStream input, RecognizerSharedState state) - : base(input, state) { - InitializeCyclicDFAs(); - - - } - - - override public string[] TokenNames { - get { return SqlGenerator.tokenNames; } - } - - override public string GrammarFileName { - get { return "C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g"; } - } - - - - // $ANTLR start "statement" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:27:1: statement : ( selectStatement | updateStatement | deleteStatement | insertStatement ); - public void statement() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:28:2: ( selectStatement | updateStatement | deleteStatement | insertStatement ) - int alt1 = 4; - switch ( input.LA(1) ) - { - case SELECT: - { - alt1 = 1; - } - break; - case UPDATE: - { - alt1 = 2; - } - break; - case DELETE: - { - alt1 = 3; - } - break; - case INSERT: - { - alt1 = 4; - } - break; - default: - if ( state.backtracking > 0 ) {state.failed = true; return ;} - NoViableAltException nvae_d1s0 = - new NoViableAltException("", 1, 0, input); - - throw nvae_d1s0; - } - - switch (alt1) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:28:4: selectStatement - { - PushFollow(FOLLOW_selectStatement_in_statement57); - selectStatement(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - case 2 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:29:4: updateStatement - { - PushFollow(FOLLOW_updateStatement_in_statement62); - updateStatement(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - case 3 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:30:4: deleteStatement - { - PushFollow(FOLLOW_deleteStatement_in_statement67); - deleteStatement(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - case 4 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:31:4: insertStatement - { - PushFollow(FOLLOW_insertStatement_in_statement72); - insertStatement(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "statement" - - - // $ANTLR start "selectStatement" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:34:1: selectStatement : ^( SELECT selectClause from ( ^( WHERE whereExpr ) )? ( ^( GROUP groupExprs ( ^( HAVING booleanExpr[false] ) )? ) )? ( ^( ORDER orderExprs ) )? ) ; - public void selectStatement() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:35:2: ( ^( SELECT selectClause from ( ^( WHERE whereExpr ) )? ( ^( GROUP groupExprs ( ^( HAVING booleanExpr[false] ) )? ) )? ( ^( ORDER orderExprs ) )? ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:35:4: ^( SELECT selectClause from ( ^( WHERE whereExpr ) )? ( ^( GROUP groupExprs ( ^( HAVING booleanExpr[false] ) )? ) )? ( ^( ORDER orderExprs ) )? ) - { - Match(input,SELECT,FOLLOW_SELECT_in_selectStatement84); if (state.failed) return ; - - if ( (state.backtracking==0) ) - { - Out("select "); - } - - Match(input, Token.DOWN, null); if (state.failed) return ; - PushFollow(FOLLOW_selectClause_in_selectStatement90); - selectClause(); - state.followingStackPointer--; - if (state.failed) return ; - PushFollow(FOLLOW_from_in_selectStatement94); - from(); - state.followingStackPointer--; - if (state.failed) return ; - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:38:3: ( ^( WHERE whereExpr ) )? - int alt2 = 2; - int LA2_0 = input.LA(1); - - if ( (LA2_0 == WHERE) ) - { - alt2 = 1; - } - switch (alt2) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:38:5: ^( WHERE whereExpr ) - { - Match(input,WHERE,FOLLOW_WHERE_in_selectStatement101); if (state.failed) return ; - - if ( (state.backtracking==0) ) - { - Out(" where "); - } - - Match(input, Token.DOWN, null); if (state.failed) return ; - PushFollow(FOLLOW_whereExpr_in_selectStatement105); - whereExpr(); - state.followingStackPointer--; - if (state.failed) return ; - - Match(input, Token.UP, null); if (state.failed) return ; - - } - break; - - } - - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:39:3: ( ^( GROUP groupExprs ( ^( HAVING booleanExpr[false] ) )? ) )? - int alt4 = 2; - int LA4_0 = input.LA(1); - - if ( (LA4_0 == GROUP) ) - { - alt4 = 1; - } - switch (alt4) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:39:5: ^( GROUP groupExprs ( ^( HAVING booleanExpr[false] ) )? ) - { - Match(input,GROUP,FOLLOW_GROUP_in_selectStatement117); if (state.failed) return ; - - if ( (state.backtracking==0) ) - { - Out(" group by "); - } - - Match(input, Token.DOWN, null); if (state.failed) return ; - PushFollow(FOLLOW_groupExprs_in_selectStatement121); - groupExprs(); - state.followingStackPointer--; - if (state.failed) return ; - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:39:47: ( ^( HAVING booleanExpr[false] ) )? - int alt3 = 2; - int LA3_0 = input.LA(1); - - if ( (LA3_0 == HAVING) ) - { - alt3 = 1; - } - switch (alt3) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:39:49: ^( HAVING booleanExpr[false] ) - { - Match(input,HAVING,FOLLOW_HAVING_in_selectStatement126); if (state.failed) return ; - - if ( (state.backtracking==0) ) - { - Out(" having "); - } - - Match(input, Token.DOWN, null); if (state.failed) return ; - PushFollow(FOLLOW_booleanExpr_in_selectStatement130); - booleanExpr(false); - state.followingStackPointer--; - if (state.failed) return ; - - Match(input, Token.UP, null); if (state.failed) return ; - - } - break; - - } - - - Match(input, Token.UP, null); if (state.failed) return ; - - } - break; - - } - - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:40:3: ( ^( ORDER orderExprs ) )? - int alt5 = 2; - int LA5_0 = input.LA(1); - - if ( (LA5_0 == ORDER) ) - { - alt5 = 1; - } - switch (alt5) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:40:5: ^( ORDER orderExprs ) - { - Match(input,ORDER,FOLLOW_ORDER_in_selectStatement147); if (state.failed) return ; - - if ( (state.backtracking==0) ) - { - Out(" order by "); - } - - Match(input, Token.DOWN, null); if (state.failed) return ; - PushFollow(FOLLOW_orderExprs_in_selectStatement151); - orderExprs(); - state.followingStackPointer--; - if (state.failed) return ; - - Match(input, Token.UP, null); if (state.failed) return ; - - } - break; - - } - - - Match(input, Token.UP, null); if (state.failed) return ; - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "selectStatement" - - - // $ANTLR start "updateStatement" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:47:1: updateStatement : ^( UPDATE ^( FROM fromTable ) setClause ( whereClause )? ) ; - public void updateStatement() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:48:2: ( ^( UPDATE ^( FROM fromTable ) setClause ( whereClause )? ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:48:4: ^( UPDATE ^( FROM fromTable ) setClause ( whereClause )? ) - { - Match(input,UPDATE,FOLLOW_UPDATE_in_updateStatement174); if (state.failed) return ; - - if ( (state.backtracking==0) ) - { - Out("update "); - } - - Match(input, Token.DOWN, null); if (state.failed) return ; - Match(input,FROM,FOLLOW_FROM_in_updateStatement182); if (state.failed) return ; - - Match(input, Token.DOWN, null); if (state.failed) return ; - PushFollow(FOLLOW_fromTable_in_updateStatement184); - fromTable(); - state.followingStackPointer--; - if (state.failed) return ; - - Match(input, Token.UP, null); if (state.failed) return ; - PushFollow(FOLLOW_setClause_in_updateStatement190); - setClause(); - state.followingStackPointer--; - if (state.failed) return ; - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:51:3: ( whereClause )? - int alt6 = 2; - int LA6_0 = input.LA(1); - - if ( (LA6_0 == WHERE) ) - { - alt6 = 1; - } - switch (alt6) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:51:4: whereClause - { - PushFollow(FOLLOW_whereClause_in_updateStatement195); - whereClause(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - - - Match(input, Token.UP, null); if (state.failed) return ; - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "updateStatement" - - - // $ANTLR start "deleteStatement" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:55:1: deleteStatement : ^( DELETE from ( whereClause )? ) ; - public void deleteStatement() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:57:2: ( ^( DELETE from ( whereClause )? ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:57:4: ^( DELETE from ( whereClause )? ) - { - Match(input,DELETE,FOLLOW_DELETE_in_deleteStatement214); if (state.failed) return ; - - if ( (state.backtracking==0) ) - { - Out("delete"); - } - - Match(input, Token.DOWN, null); if (state.failed) return ; - PushFollow(FOLLOW_from_in_deleteStatement220); - from(); - state.followingStackPointer--; - if (state.failed) return ; - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:59:3: ( whereClause )? - int alt7 = 2; - int LA7_0 = input.LA(1); - - if ( (LA7_0 == WHERE) ) - { - alt7 = 1; - } - switch (alt7) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:59:4: whereClause - { - PushFollow(FOLLOW_whereClause_in_deleteStatement225); - whereClause(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - - - Match(input, Token.UP, null); if (state.failed) return ; - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "deleteStatement" - - - // $ANTLR start "insertStatement" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:63:1: insertStatement : ^( INSERT i= INTO selectStatement ) ; - public void insertStatement() // throws RecognitionException [1] - { - IASTNode i = null; - - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:64:2: ( ^( INSERT i= INTO selectStatement ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:64:4: ^( INSERT i= INTO selectStatement ) - { - Match(input,INSERT,FOLLOW_INSERT_in_insertStatement242); if (state.failed) return ; - - if ( (state.backtracking==0) ) - { - Out( "insert " ); - } - - Match(input, Token.DOWN, null); if (state.failed) return ; - i=(IASTNode)Match(input,INTO,FOLLOW_INTO_in_insertStatement250); if (state.failed) return ; - if ( (state.backtracking==0) ) - { - Out( i ); Out( " " ); - } - PushFollow(FOLLOW_selectStatement_in_insertStatement256); - selectStatement(); - state.followingStackPointer--; - if (state.failed) return ; - - Match(input, Token.UP, null); if (state.failed) return ; - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "insertStatement" - - - // $ANTLR start "setClause" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:70:1: setClause : ^( SET comparisonExpr[false] ( comparisonExpr[false] )* ) ; - public void setClause() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:73:2: ( ^( SET comparisonExpr[false] ( comparisonExpr[false] )* ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:73:4: ^( SET comparisonExpr[false] ( comparisonExpr[false] )* ) - { - Match(input,SET,FOLLOW_SET_in_setClause276); if (state.failed) return ; - - if ( (state.backtracking==0) ) - { - Out(" set "); - } - - Match(input, Token.DOWN, null); if (state.failed) return ; - PushFollow(FOLLOW_comparisonExpr_in_setClause280); - comparisonExpr(false); - state.followingStackPointer--; - if (state.failed) return ; - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:73:51: ( comparisonExpr[false] )* - do - { - int alt8 = 2; - int LA8_0 = input.LA(1); - - if ( (LA8_0 == BETWEEN || LA8_0 == EXISTS || LA8_0 == IN || LA8_0 == LIKE || (LA8_0 >= IS_NOT_NULL && LA8_0 <= IS_NULL) || (LA8_0 >= NOT_BETWEEN && LA8_0 <= NOT_LIKE) || LA8_0 == EQ || LA8_0 == NE || (LA8_0 >= LT && LA8_0 <= GE)) ) - { - alt8 = 1; - } - - - switch (alt8) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:73:53: comparisonExpr[false] - { - if ( (state.backtracking==0) ) - { - Out(", "); - } - PushFollow(FOLLOW_comparisonExpr_in_setClause287); - comparisonExpr(false); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - default: - goto loop8; - } - } while (true); - - loop8: - ; // Stops C# compiler whining that label 'loop8' has no statements - - - Match(input, Token.UP, null); if (state.failed) return ; - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "setClause" - - - // $ANTLR start "whereClause" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:76:1: whereClause : ^( WHERE whereClauseExpr ) ; - public void whereClause() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:77:2: ( ^( WHERE whereClauseExpr ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:77:4: ^( WHERE whereClauseExpr ) - { - Match(input,WHERE,FOLLOW_WHERE_in_whereClause305); if (state.failed) return ; - - if ( (state.backtracking==0) ) - { - Out(" where "); - } - - Match(input, Token.DOWN, null); if (state.failed) return ; - PushFollow(FOLLOW_whereClauseExpr_in_whereClause309); - whereClauseExpr(); - state.followingStackPointer--; - if (state.failed) return ; - - Match(input, Token.UP, null); if (state.failed) return ; - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "whereClause" - - - // $ANTLR start "whereClauseExpr" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:80:1: whereClauseExpr : ( ( SQL_TOKEN )=> conditionList | booleanExpr[ false ] ); - public void whereClauseExpr() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:81:2: ( ( SQL_TOKEN )=> conditionList | booleanExpr[ false ] ) - int alt9 = 2; - int LA9_0 = input.LA(1); - - if ( (LA9_0 == SQL_TOKEN) ) - { - int LA9_1 = input.LA(2); - - if ( (LA9_1 == DOWN) && (synpred1_SqlGenerator()) ) - { - alt9 = 1; - } - else if ( (LA9_1 == UP) ) - { - alt9 = 2; - } - else - { - if ( state.backtracking > 0 ) {state.failed = true; return ;} - NoViableAltException nvae_d9s1 = - new NoViableAltException("", 9, 1, input); - - throw nvae_d9s1; - } - } - else if ( (LA9_0 == AND || LA9_0 == BETWEEN || LA9_0 == EXISTS || LA9_0 == IN || LA9_0 == LIKE || LA9_0 == NOT || LA9_0 == OR || (LA9_0 >= IS_NOT_NULL && LA9_0 <= IS_NULL) || (LA9_0 >= NOT_BETWEEN && LA9_0 <= NOT_LIKE) || LA9_0 == EQ || LA9_0 == NE || (LA9_0 >= LT && LA9_0 <= GE)) ) - { - alt9 = 2; - } - else - { - if ( state.backtracking > 0 ) {state.failed = true; return ;} - NoViableAltException nvae_d9s0 = - new NoViableAltException("", 9, 0, input); - - throw nvae_d9s0; - } - switch (alt9) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:81:4: ( SQL_TOKEN )=> conditionList - { - PushFollow(FOLLOW_conditionList_in_whereClauseExpr328); - conditionList(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - case 2 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:82:4: booleanExpr[ false ] - { - PushFollow(FOLLOW_booleanExpr_in_whereClauseExpr333); - booleanExpr(false); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "whereClauseExpr" - - - // $ANTLR start "orderExprs" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:85:1: orderExprs : ( expr ) (dir= orderDirection )? ( orderExprs )? ; - public void orderExprs() // throws RecognitionException [1] - { - SqlGenerator.orderDirection_return dir = default(SqlGenerator.orderDirection_return); - - - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:87:2: ( ( expr ) (dir= orderDirection )? ( orderExprs )? ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:87:4: ( expr ) (dir= orderDirection )? ( orderExprs )? - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:87:4: ( expr ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:87:6: expr - { - PushFollow(FOLLOW_expr_in_orderExprs349); - expr(); - state.followingStackPointer--; - if (state.failed) return ; - - } - - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:87:13: (dir= orderDirection )? - int alt10 = 2; - int LA10_0 = input.LA(1); - - if ( (LA10_0 == ASCENDING || LA10_0 == DESCENDING) ) - { - alt10 = 1; - } - switch (alt10) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:87:14: dir= orderDirection - { - PushFollow(FOLLOW_orderDirection_in_orderExprs356); - dir = orderDirection(); - state.followingStackPointer--; - if (state.failed) return ; - if ( (state.backtracking==0) ) - { - Out(" "); Out(((dir != null) ? ((IASTNode)dir.Start) : null)); - } - - } - break; - - } - - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:87:66: ( orderExprs )? - int alt11 = 2; - int LA11_0 = input.LA(1); - - if ( ((LA11_0 >= ALL && LA11_0 <= ANY) || LA11_0 == COUNT || LA11_0 == DOT || LA11_0 == FALSE || LA11_0 == NULL || LA11_0 == SELECT || LA11_0 == SOME || LA11_0 == TRUE || LA11_0 == CASE || LA11_0 == AGGREGATE || LA11_0 == CASE2 || LA11_0 == INDEX_OP || LA11_0 == METHOD_CALL || LA11_0 == UNARY_MINUS || LA11_0 == VECTOR_EXPR || (LA11_0 >= CONSTANT && LA11_0 <= JAVA_CONSTANT) || (LA11_0 >= PLUS && LA11_0 <= DIV) || (LA11_0 >= PARAM && LA11_0 <= IDENT) || LA11_0 == ALIAS_REF || LA11_0 == SQL_TOKEN || LA11_0 == NAMED_PARAM) ) - { - alt11 = 1; - } - switch (alt11) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:87:68: orderExprs - { - if ( (state.backtracking==0) ) - { - Out(", "); - } - PushFollow(FOLLOW_orderExprs_in_orderExprs366); - orderExprs(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "orderExprs" - - - // $ANTLR start "groupExprs" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:90:1: groupExprs : expr ( groupExprs )? ; - public void groupExprs() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:92:2: ( expr ( groupExprs )? ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:92:4: expr ( groupExprs )? - { - PushFollow(FOLLOW_expr_in_groupExprs381); - expr(); - state.followingStackPointer--; - if (state.failed) return ; - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:92:9: ( groupExprs )? - int alt12 = 2; - int LA12_0 = input.LA(1); - - if ( ((LA12_0 >= ALL && LA12_0 <= ANY) || LA12_0 == COUNT || LA12_0 == DOT || LA12_0 == FALSE || LA12_0 == NULL || LA12_0 == SELECT || LA12_0 == SOME || LA12_0 == TRUE || LA12_0 == CASE || LA12_0 == AGGREGATE || LA12_0 == CASE2 || LA12_0 == INDEX_OP || LA12_0 == METHOD_CALL || LA12_0 == UNARY_MINUS || LA12_0 == VECTOR_EXPR || (LA12_0 >= CONSTANT && LA12_0 <= JAVA_CONSTANT) || (LA12_0 >= PLUS && LA12_0 <= DIV) || (LA12_0 >= PARAM && LA12_0 <= IDENT) || LA12_0 == ALIAS_REF || LA12_0 == SQL_TOKEN || LA12_0 == NAMED_PARAM) ) - { - alt12 = 1; - } - switch (alt12) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:92:11: groupExprs - { - if ( (state.backtracking==0) ) - { - Out(" , "); - } - PushFollow(FOLLOW_groupExprs_in_groupExprs387); - groupExprs(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "groupExprs" - - public class orderDirection_return : TreeRuleReturnScope - { - }; - - // $ANTLR start "orderDirection" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:95:1: orderDirection : ( ASCENDING | DESCENDING ); - public SqlGenerator.orderDirection_return orderDirection() // throws RecognitionException [1] - { - SqlGenerator.orderDirection_return retval = new SqlGenerator.orderDirection_return(); - retval.Start = input.LT(1); - - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:96:2: ( ASCENDING | DESCENDING ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g: - { - if ( input.LA(1) == ASCENDING || input.LA(1) == DESCENDING ) - { - input.Consume(); - state.errorRecovery = false;state.failed = false; - } - else - { - if ( state.backtracking > 0 ) {state.failed = true; return retval;} - MismatchedSetException mse = new MismatchedSetException(null,input); - throw mse; - } - - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return retval; - } - // $ANTLR end "orderDirection" - - - // $ANTLR start "whereExpr" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:100:1: whereExpr : ( filters ( thetaJoins )? ( booleanExpr[ true ] )? | thetaJoins ( booleanExpr[ true ] )? | booleanExpr[false] ); - public void whereExpr() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:104:2: ( filters ( thetaJoins )? ( booleanExpr[ true ] )? | thetaJoins ( booleanExpr[ true ] )? | booleanExpr[false] ) - int alt16 = 3; - switch ( input.LA(1) ) - { - case FILTERS: - { - alt16 = 1; - } - break; - case THETA_JOINS: - { - alt16 = 2; - } - break; - case AND: - case BETWEEN: - case EXISTS: - case IN: - case LIKE: - case NOT: - case OR: - case IS_NOT_NULL: - case IS_NULL: - case NOT_BETWEEN: - case NOT_IN: - case NOT_LIKE: - case EQ: - case NE: - case LT: - case GT: - case LE: - case GE: - case SQL_TOKEN: - { - alt16 = 3; - } - break; - default: - if ( state.backtracking > 0 ) {state.failed = true; return ;} - NoViableAltException nvae_d16s0 = - new NoViableAltException("", 16, 0, input); - - throw nvae_d16s0; - } - - switch (alt16) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:104:4: filters ( thetaJoins )? ( booleanExpr[ true ] )? - { - PushFollow(FOLLOW_filters_in_whereExpr422); - filters(); - state.followingStackPointer--; - if (state.failed) return ; - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:105:3: ( thetaJoins )? - int alt13 = 2; - int LA13_0 = input.LA(1); - - if ( (LA13_0 == THETA_JOINS) ) - { - alt13 = 1; - } - switch (alt13) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:105:5: thetaJoins - { - if ( (state.backtracking==0) ) - { - Out(" and "); - } - PushFollow(FOLLOW_thetaJoins_in_whereExpr430); - thetaJoins(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:106:3: ( booleanExpr[ true ] )? - int alt14 = 2; - int LA14_0 = input.LA(1); - - if ( (LA14_0 == AND || LA14_0 == BETWEEN || LA14_0 == EXISTS || LA14_0 == IN || LA14_0 == LIKE || LA14_0 == NOT || LA14_0 == OR || (LA14_0 >= IS_NOT_NULL && LA14_0 <= IS_NULL) || (LA14_0 >= NOT_BETWEEN && LA14_0 <= NOT_LIKE) || LA14_0 == EQ || LA14_0 == NE || (LA14_0 >= LT && LA14_0 <= GE) || LA14_0 == SQL_TOKEN) ) - { - alt14 = 1; - } - switch (alt14) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:106:5: booleanExpr[ true ] - { - if ( (state.backtracking==0) ) - { - Out(" and "); - } - PushFollow(FOLLOW_booleanExpr_in_whereExpr441); - booleanExpr(true); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - - - } - break; - case 2 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:107:4: thetaJoins ( booleanExpr[ true ] )? - { - PushFollow(FOLLOW_thetaJoins_in_whereExpr451); - thetaJoins(); - state.followingStackPointer--; - if (state.failed) return ; - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:108:3: ( booleanExpr[ true ] )? - int alt15 = 2; - int LA15_0 = input.LA(1); - - if ( (LA15_0 == AND || LA15_0 == BETWEEN || LA15_0 == EXISTS || LA15_0 == IN || LA15_0 == LIKE || LA15_0 == NOT || LA15_0 == OR || (LA15_0 >= IS_NOT_NULL && LA15_0 <= IS_NULL) || (LA15_0 >= NOT_BETWEEN && LA15_0 <= NOT_LIKE) || LA15_0 == EQ || LA15_0 == NE || (LA15_0 >= LT && LA15_0 <= GE) || LA15_0 == SQL_TOKEN) ) - { - alt15 = 1; - } - switch (alt15) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:108:5: booleanExpr[ true ] - { - if ( (state.backtracking==0) ) - { - Out(" and "); - } - PushFollow(FOLLOW_booleanExpr_in_whereExpr459); - booleanExpr(true); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - - - } - break; - case 3 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:109:4: booleanExpr[false] - { - PushFollow(FOLLOW_booleanExpr_in_whereExpr470); - booleanExpr(false); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "whereExpr" - - - // $ANTLR start "filters" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:112:1: filters : ^( FILTERS conditionList ) ; - public void filters() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:113:2: ( ^( FILTERS conditionList ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:113:4: ^( FILTERS conditionList ) - { - Match(input,FILTERS,FOLLOW_FILTERS_in_filters483); if (state.failed) return ; - - Match(input, Token.DOWN, null); if (state.failed) return ; - PushFollow(FOLLOW_conditionList_in_filters485); - conditionList(); - state.followingStackPointer--; - if (state.failed) return ; - - Match(input, Token.UP, null); if (state.failed) return ; - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "filters" - - - // $ANTLR start "thetaJoins" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:116:1: thetaJoins : ^( THETA_JOINS conditionList ) ; - public void thetaJoins() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:117:2: ( ^( THETA_JOINS conditionList ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:117:4: ^( THETA_JOINS conditionList ) - { - Match(input,THETA_JOINS,FOLLOW_THETA_JOINS_in_thetaJoins499); if (state.failed) return ; - - Match(input, Token.DOWN, null); if (state.failed) return ; - PushFollow(FOLLOW_conditionList_in_thetaJoins501); - conditionList(); - state.followingStackPointer--; - if (state.failed) return ; - - Match(input, Token.UP, null); if (state.failed) return ; - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "thetaJoins" - - - // $ANTLR start "conditionList" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:120:1: conditionList : sqlToken ( conditionList )? ; - public void conditionList() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:121:2: ( sqlToken ( conditionList )? ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:121:4: sqlToken ( conditionList )? - { - PushFollow(FOLLOW_sqlToken_in_conditionList514); - sqlToken(); - state.followingStackPointer--; - if (state.failed) return ; - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:121:13: ( conditionList )? - int alt17 = 2; - int LA17_0 = input.LA(1); - - if ( (LA17_0 == SQL_TOKEN) ) - { - alt17 = 1; - } - switch (alt17) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:121:15: conditionList - { - if ( (state.backtracking==0) ) - { - Out(" and "); - } - PushFollow(FOLLOW_conditionList_in_conditionList520); - conditionList(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "conditionList" - - - // $ANTLR start "selectClause" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:124:1: selectClause : ^( SELECT_CLAUSE ( distinctOrAll )? ( selectColumn )+ ) ; - public void selectClause() // throws RecognitionException [1] - { - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:125:2: ( ^( SELECT_CLAUSE ( distinctOrAll )? ( selectColumn )+ ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:125:4: ^( SELECT_CLAUSE ( distinctOrAll )? ( selectColumn )+ ) - { - Match(input,SELECT_CLAUSE,FOLLOW_SELECT_CLAUSE_in_selectClause535); if (state.failed) return ; - - Match(input, Token.DOWN, null); if (state.failed) return ; - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:125:20: ( distinctOrAll )? - int alt18 = 2; - int LA18_0 = input.LA(1); - - if ( (LA18_0 == ALL || LA18_0 == DISTINCT) ) - { - alt18 = 1; - } - switch (alt18) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:125:21: distinctOrAll - { - PushFollow(FOLLOW_distinctOrAll_in_selectClause538); - distinctOrAll(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - } - - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:125:37: ( selectColumn )+ - int cnt19 = 0; - do - { - int alt19 = 2; - int LA19_0 = input.LA(1); - - if ( (LA19_0 == COUNT || LA19_0 == DOT || LA19_0 == FALSE || LA19_0 == SELECT || LA19_0 == TRUE || LA19_0 == CASE || LA19_0 == AGGREGATE || (LA19_0 >= CONSTRUCTOR && LA19_0 <= CASE2) || LA19_0 == METHOD_CALL || LA19_0 == UNARY_MINUS || (LA19_0 >= CONSTANT && LA19_0 <= JAVA_CONSTANT) || (LA19_0 >= PLUS && LA19_0 <= DIV) || (LA19_0 >= PARAM && LA19_0 <= IDENT) || LA19_0 == ALIAS_REF || LA19_0 == SQL_TOKEN || LA19_0 == SELECT_EXPR) ) - { - alt19 = 1; - } - - - switch (alt19) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:125:39: selectColumn - { - PushFollow(FOLLOW_selectColumn_in_selectClause544); - selectColumn(); - state.followingStackPointer--; - if (state.failed) return ; - - } - break; - - default: - if ( cnt19 >= 1 ) goto loop19; - if ( state.backtracking > 0 ) {state.failed = true; return ;} - EarlyExitException eee19 = - new EarlyExitException(19, input); - throw eee19; - } - cnt19++; - } while (true); - - loop19: - ; // Stops C# compiler whinging that label 'loop19' has no statements - - - Match(input, Token.UP, null); if (state.failed) return ; - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "selectClause" - - - // $ANTLR start "selectColumn" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:128:1: selectColumn : p= selectExpr (sc= SELECT_COLUMNS )? ; - public void selectColumn() // throws RecognitionException [1] - { - IASTNode sc = null; - SqlGenerator.selectExpr_return p = default(SqlGenerator.selectExpr_return); - - - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:129:2: (p= selectExpr (sc= SELECT_COLUMNS )? ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:129:4: p= selectExpr (sc= SELECT_COLUMNS )? - { - PushFollow(FOLLOW_selectExpr_in_selectColumn562); - p = selectExpr(); - state.followingStackPointer--; - if (state.failed) return ; - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:129:17: (sc= SELECT_COLUMNS )? - int alt20 = 2; - int LA20_0 = input.LA(1); - - if ( (LA20_0 == SELECT_COLUMNS) ) - { - alt20 = 1; - } - switch (alt20) - { - case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:129:18: sc= SELECT_COLUMNS - { - sc=(IASTNode)Match(input,SELECT_COLUMNS,FOLLOW_SELECT_COLUMNS_in_selectColumn567); if (state.failed) return ; - if ( (state.backtracking==0) ) - { - Out(sc); - } - - } - break; - - } - - if ( (state.backtracking==0) ) - { - Separator( (sc != null) ? sc : ((p != null) ? ((IASTNode)p.Start) : null) ,", "); - } - - } - - } - catch (RecognitionException re) - { - ReportError(re); - Recover(input,re); - } - finally - { - } - return ; - } - // $ANTLR end "selectColumn" - - public class selectExpr_return : TreeRuleReturnScope - { - }; - - // $ANTLR start "selectExpr" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:132:1: selectExpr : (e= selectAtom | count | ^( CONSTRUCTOR ( DOT | IDENT ) ( selectColumn )+ ) | methodCall | aggregate | c= constant | arithmeticExpr | param= PARAM | selectStatement ); - public SqlGenerator.selectExpr_return selectExpr() // throws RecognitionException [1] - { - SqlGenerator.selectExpr_return retval = new SqlGenerator.selectExpr_return(); - retval.Start = input.LT(1); - - IASTNode param = null; - SqlGenerator.selectAtom_return e = default(SqlGenerator.selectAtom_return); - - SqlGenerator.constant_return c = default(SqlGenerator.constant_return); - - - try - { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\SqlGenerator.g:133:2: (e= selectAtom | count | ^( CONSTRUCTOR ( DOT | IDENT ) ( selectColumn )+ ) | methodCall | aggregate | c= constant | arithmeticExpr | param= PARAM | selectStatement ) - int alt22 = 9; - switch ( input.LA(1) ) - { - case DOT: - case ALIAS_REF: - case SQL_TOKEN: - case SELE... [truncated message content] |
From: <fab...@us...> - 2009-05-07 05:49:03
|
Revision: 4259 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4259&view=rev Author: fabiomaulo Date: 2009-05-07 05:49:01 +0000 (Thu, 07 May 2009) Log Message: ----------- Test for NH-1734 Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs 2009-05-07 05:02:56 UTC (rev 4258) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs 2009-05-07 05:49:01 UTC (rev 4259) @@ -1,3 +1,4 @@ +using System; using System.Collections; using NHibernate.Engine.Query; using NHibernate.Util; @@ -91,5 +92,30 @@ s.Transaction.Commit(); } } + + [Test, Ignore("Not fixed yet.")] + public void SumShouldReturnDouble() + { + // NH-1734 + using (ISession s = OpenSession()) + using (s.BeginTransaction()) + { + s.Save(new Human{ IntValue = 11, BodyWeight = 12.5f, Description = "Polliwog" }); + s.Transaction.Commit(); + } + + using (ISession s = OpenSession()) + { + var l = s.CreateQuery("select sum(a.intValue * a.bodyWeight) from Animal a group by a.id").List(); + Assert.That(l[0], Is.InstanceOf<Double>()); + } + + using (ISession s = OpenSession()) + using (s.BeginTransaction()) + { + s.CreateQuery("delete from Animal").ExecuteUpdate(); + s.Transaction.Commit(); + } + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-07 05:02:58
|
Revision: 4258 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4258&view=rev Author: fabiomaulo Date: 2009-05-07 05:02:56 +0000 (Thu, 07 May 2009) Log Message: ----------- - CR-LF in BulkManipulation - moved test to Ast - ReturnMetadata now is working - NH-322 was fixed with the new parser Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs Removed Paths: ------------- trunk/nhibernate/src/NHibernate.Test/HQL/HqlFixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-07 03:34:37 UTC (rev 4257) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-07 05:02:56 UTC (rev 4258) @@ -228,17 +228,17 @@ [Test] public void UpdateOnManyToOne() - { + { ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); - - s.CreateQuery("update Animal a set a.mother = null where a.id = 2").ExecuteUpdate(); + + s.CreateQuery("update Animal a set a.mother = null where a.id = 2").ExecuteUpdate(); if (! (Dialect is MySQLDialect)) - { - // MySQL does not support (even un-correlated) subqueries against the update-mutating table - s.CreateQuery("update Animal a set a.mother = (from Animal where id = 1) where a.id = 2").ExecuteUpdate(); - } - + { + // MySQL does not support (even un-correlated) subqueries against the update-mutating table + s.CreateQuery("update Animal a set a.mother = (from Animal where id = 1) where a.id = 2").ExecuteUpdate(); + } + t.Commit(); s.Close(); } @@ -310,70 +310,70 @@ s.Close(); data.Cleanup(); - } + } [Test] public void UpdateOnAnimal() - { + { var data = new TestData(this); data.Prepare(); ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); int count = - s.CreateQuery("update Animal set description = description where description = :desc") - .SetString("desc", data.Frog.Description) + s.CreateQuery("update Animal set description = description where description = :desc") + .SetString("desc", data.Frog.Description) .ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "Incorrect entity-updated count"); - + count = - s.CreateQuery("update Animal set description = :newDesc where description = :desc") - .SetString("desc",data.Polliwog.Description) - .SetString("newDesc", "Tadpole") + s.CreateQuery("update Animal set description = :newDesc where description = :desc") + .SetString("desc",data.Polliwog.Description) + .SetString("newDesc", "Tadpole") .ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "Incorrect entity-updated count"); - + var tadpole = s.Load<Animal>(data.Polliwog.Id); Assert.That(tadpole.Description, Is.EqualTo("Tadpole"), "Update did not take effect"); - + count = s.CreateQuery("update Animal set bodyWeight = bodyWeight + :w1 + :w2") .SetDouble("w1", 1) - .SetDouble("w2", 2) + .SetDouble("w2", 2) .ExecuteUpdate(); Assert.That(count, Is.EqualTo(6), "incorrect count on 'complex' update assignment"); - + if (! (Dialect is MySQLDialect)) - { - // MySQL does not support (even un-correlated) subqueries against the update-mutating table - s.CreateQuery("update Animal set bodyWeight = ( select max(bodyWeight) from Animal )").ExecuteUpdate(); + { + // MySQL does not support (even un-correlated) subqueries against the update-mutating table + s.CreateQuery("update Animal set bodyWeight = ( select max(bodyWeight) from Animal )").ExecuteUpdate(); } t.Commit(); s.Close(); data.Cleanup(); - } + } [Test] public void UpdateOnMammal() - { + { var data = new TestData(this); data.Prepare(); ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); - + int count = s.CreateQuery("update Mammal set description = description").ExecuteUpdate(); Assert.That(count, Is.EqualTo(2), "incorrect update count against 'middle' of joined-subclass hierarchy"); - + count = s.CreateQuery("update Mammal set bodyWeight = 25").ExecuteUpdate(); Assert.That(count, Is.EqualTo(2), "incorrect update count against 'middle' of joined-subclass hierarchy"); - + if (! (Dialect is MySQLDialect)) { - // MySQL does not support (even un-correlated) subqueries against the update-mutating table + // MySQL does not support (even un-correlated) subqueries against the update-mutating table count = s.CreateQuery("update Mammal set bodyWeight = ( select max(bodyWeight) from Animal )").ExecuteUpdate(); Assert.That(count, Is.EqualTo(2), "incorrect update count against 'middle' of joined-subclass hierarchy"); } @@ -462,7 +462,7 @@ s.Close(); data.Cleanup(); - } + } #endregion Copied: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs (from rev 4248, trunk/nhibernate/src/NHibernate.Test/HQL/HqlFixture.cs) =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/HqlFixture.cs 2009-05-07 05:02:56 UTC (rev 4258) @@ -0,0 +1,95 @@ +using System.Collections; +using NHibernate.Engine.Query; +using NHibernate.Util; +using NUnit.Framework; + +namespace NHibernate.Test.HQL.Ast +{ + [TestFixture] + public class HqlFixture : BaseFixture + { + protected HQLQueryPlan CreateQueryPlan(string hql, bool scalar) + { + return new HQLQueryPlan(hql, scalar, new CollectionHelper.EmptyMapClass<string, IFilter>(), sessions); + } + + protected HQLQueryPlan CreateQueryPlan(string hql) + { + return CreateQueryPlan(hql, false); + } + + private static void Check(ReturnMetadata returnMetadata, bool expectingEmptyTypes, bool expectingEmptyAliases) + { + Assert.IsNotNull(returnMetadata, "null return metadata"); + Assert.IsNotNull(returnMetadata, "null return metadata - types"); + Assert.AreEqual(1, returnMetadata.ReturnTypes.Length, "unexpected return size"); + + if (expectingEmptyTypes) + { + Assert.IsNull(returnMetadata.ReturnTypes[0], "non-empty types"); + } + else + { + Assert.IsNotNull(returnMetadata.ReturnTypes[0], "empty types"); + } + + if (expectingEmptyAliases) + { + Assert.IsNull(returnMetadata.ReturnAliases, "non-empty aliases"); + } + else + { + Assert.IsNotNull(returnMetadata.ReturnAliases, "empty aliases"); + Assert.IsNotNull(returnMetadata.ReturnAliases[0], "empty aliases"); + } + } + + [Test] + public void ReturnMetadata() + { + HQLQueryPlan plan; + plan = CreateQueryPlan("from Animal a"); + Check(plan.ReturnMetadata, false, true); + + plan = CreateQueryPlan("select a as animal from Animal a"); + Check(plan.ReturnMetadata, false, false); + + plan = CreateQueryPlan("from System.Object"); + Check(plan.ReturnMetadata, true, true); + + plan = CreateQueryPlan("select o as entity from System.Object o"); + Check(plan.ReturnMetadata, true, false); + } + + [Test] + public void CaseClauseInSelect() + { + // NH-322 + using (ISession s = OpenSession()) + using (s.BeginTransaction()) + { + s.Save(new Animal {BodyWeight = 12, Description = "Polliwog"}); + s.Transaction.Commit(); + } + + using (ISession s = OpenSession()) + { + var l = s.CreateQuery("select a.id, case when a.description = 'Polliwog' then 2 else 0 end from Animal a").List(); + var element = (IList)l[0]; + Assert.That(element[1], Is.EqualTo(2)); + + // work with alias + l = s.CreateQuery("select a.id, case when a.description = 'Polliwog' then 2 else 0 end as value from Animal a").List(); + element = (IList)l[0]; + Assert.That(element[1], Is.EqualTo(2)); + } + + using (ISession s = OpenSession()) + using (s.BeginTransaction()) + { + s.CreateQuery("delete from Animal").ExecuteUpdate(); + s.Transaction.Commit(); + } + } + } +} \ No newline at end of file Deleted: trunk/nhibernate/src/NHibernate.Test/HQL/HqlFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/HqlFixture.cs 2009-05-07 03:34:37 UTC (rev 4257) +++ trunk/nhibernate/src/NHibernate.Test/HQL/HqlFixture.cs 2009-05-07 05:02:56 UTC (rev 4258) @@ -1,74 +0,0 @@ -using System.Collections; -using NHibernate.Engine.Query; -using NHibernate.Util; -using NUnit.Framework; - -namespace NHibernate.Test.Hql -{ - [TestFixture, Ignore("Not supported yet.")] - public class HqlFixture : TestCase - { - protected override string MappingsAssembly - { - get { return "NHibernate.Test"; } - } - - protected override IList Mappings - { - get { return new[] {"HQL.Animal.hbm.xml"}; } - } - - protected HQLQueryPlan CreateQueryPlan(string hql, bool scalar) - { - return new HQLQueryPlan(hql, scalar, new CollectionHelper.EmptyMapClass<string, IFilter>(), sessions); - } - - protected HQLQueryPlan CreateQueryPlan(string hql) - { - return CreateQueryPlan(hql, false); - } - - private static void Check(ReturnMetadata returnMetadata, bool expectingEmptyTypes, bool expectingEmptyAliases) - { - Assert.IsNotNull(returnMetadata, "null return metadata"); - Assert.IsNotNull(returnMetadata, "null return metadata - types"); - Assert.AreEqual(1, returnMetadata.ReturnTypes.Length, "unexpected return size"); - - if (expectingEmptyTypes) - { - Assert.IsNull(returnMetadata.ReturnTypes[0], "non-empty types"); - } - else - { - Assert.IsNotNull(returnMetadata.ReturnTypes[0], "empty types"); - } - - if (expectingEmptyAliases) - { - Assert.IsNull(returnMetadata.ReturnAliases, "non-empty aliases"); - } - else - { - Assert.IsNotNull(returnMetadata.ReturnAliases, "empty aliases"); - Assert.IsNotNull(returnMetadata.ReturnAliases[0], "empty aliases"); - } - } - - [Test] - public void ReturnMetadata() - { - HQLQueryPlan plan; - plan = CreateQueryPlan("from Animal a"); - Check(plan.ReturnMetadata, false, true); - - plan = CreateQueryPlan("select a as animal from Animal a"); - Check(plan.ReturnMetadata, false, false); - - plan = CreateQueryPlan("from java.lang.Object"); - Check(plan.ReturnMetadata, true, true); - - plan = CreateQueryPlan("select o as entity from java.lang.Object o"); - Check(plan.ReturnMetadata, true, false); - } - } -} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-05-07 03:34:37 UTC (rev 4257) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-05-07 05:02:56 UTC (rev 4258) @@ -364,7 +364,7 @@ <Compile Include="HQL\SQLFunctionTemplateTest.cs" /> <Compile Include="BulkManipulation\NativeSQLBulkOperations.cs" /> <Compile Include="BulkManipulation\Vehicles.cs" /> - <Compile Include="HQL\HqlFixture.cs" /> + <Compile Include="HQL\Ast\HqlFixture.cs" /> <Compile Include="IdGen\Enhanced\SequenceStyleConfigUnitFixture.cs" /> <Compile Include="IdGen\NativeGuid\NativeGuidFixture.cs" /> <Compile Include="IdGen\NativeGuid\NativeGuidGeneratorFixture.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-07 03:34:47
|
Revision: 4257 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4257&view=rev Author: fabiomaulo Date: 2009-05-07 03:34:37 +0000 (Thu, 07 May 2009) Log Message: ----------- Fix NH-1765 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Action/EntityDeleteAction.cs trunk/nhibernate/src/NHibernate/Action/EntityIdentityInsertAction.cs trunk/nhibernate/src/NHibernate/Action/EntityInsertAction.cs trunk/nhibernate/src/NHibernate/Action/EntityUpdateAction.cs trunk/nhibernate/src/NHibernate/Event/AbstractEvent.cs trunk/nhibernate/src/NHibernate/Event/PreDeleteEvent.cs trunk/nhibernate/src/NHibernate/Event/PreInsertEvent.cs trunk/nhibernate/src/NHibernate/Event/PreUpdateEvent.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs Modified: trunk/nhibernate/src/NHibernate/Action/EntityDeleteAction.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Action/EntityDeleteAction.cs 2009-05-06 22:59:51 UTC (rev 4256) +++ trunk/nhibernate/src/NHibernate/Action/EntityDeleteAction.cs 2009-05-07 03:34:37 UTC (rev 4257) @@ -117,7 +117,7 @@ bool veto = false; if (preListeners.Length > 0) { - PreDeleteEvent preEvent = new PreDeleteEvent(Instance, Id, state, Persister); + var preEvent = new PreDeleteEvent(Instance, Id, state, Persister, (IEventSource)Session); foreach (IPreDeleteEventListener listener in preListeners) { veto |= listener.OnPreDelete(preEvent); Modified: trunk/nhibernate/src/NHibernate/Action/EntityIdentityInsertAction.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Action/EntityIdentityInsertAction.cs 2009-05-06 22:59:51 UTC (rev 4256) +++ trunk/nhibernate/src/NHibernate/Action/EntityIdentityInsertAction.cs 2009-05-07 03:34:37 UTC (rev 4257) @@ -121,7 +121,7 @@ IPostInsertEventListener[] postListeners = Session.Listeners.PostCommitInsertEventListeners; if (postListeners.Length > 0) { - PostInsertEvent postEvent = new PostInsertEvent(Instance, generatedId, state, Persister, (IEventSource)Session); + var postEvent = new PostInsertEvent(Instance, generatedId, state, Persister, (IEventSource) Session); foreach (IPostInsertEventListener listener in postListeners) { listener.OnPostInsert(postEvent); @@ -135,7 +135,7 @@ bool veto = false; if (preListeners.Length > 0) { - PreInsertEvent preEvent = new PreInsertEvent(Instance, null, state, Persister, Session); + var preEvent = new PreInsertEvent(Instance, null, state, Persister, (IEventSource) Session); foreach (IPreInsertEventListener listener in preListeners) { veto |= listener.OnPreInsert(preEvent); @@ -144,7 +144,7 @@ return veto; } - //Make 100% certain that this is called before any subsequent ScheduledUpdate.afterTransactionCompletion()!! + //Make 100% certain that this is called before any subsequent ScheduledUpdate.afterTransactionCompletion()!! public override void AfterTransactionCompletion(bool success) { //TODO from H3.2: reenable if we also fix the above todo Modified: trunk/nhibernate/src/NHibernate/Action/EntityInsertAction.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Action/EntityInsertAction.cs 2009-05-06 22:59:51 UTC (rev 4256) +++ trunk/nhibernate/src/NHibernate/Action/EntityInsertAction.cs 2009-05-07 03:34:37 UTC (rev 4257) @@ -154,7 +154,7 @@ bool veto = false; if (preListeners.Length > 0) { - PreInsertEvent preEvent = new PreInsertEvent(Instance, Id, state, Persister, Session); + var preEvent = new PreInsertEvent(Instance, Id, state, Persister, (IEventSource) Session); foreach (IPreInsertEventListener listener in preListeners) { veto |= listener.OnPreInsert(preEvent); Modified: trunk/nhibernate/src/NHibernate/Action/EntityUpdateAction.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Action/EntityUpdateAction.cs 2009-05-06 22:59:51 UTC (rev 4256) +++ trunk/nhibernate/src/NHibernate/Action/EntityUpdateAction.cs 2009-05-07 03:34:37 UTC (rev 4257) @@ -193,7 +193,7 @@ bool veto = false; if (preListeners.Length > 0) { - PreUpdateEvent preEvent = new PreUpdateEvent(Instance, Id, state, previousState, Persister, Session); + var preEvent = new PreUpdateEvent(Instance, Id, state, previousState, Persister, (IEventSource) Session); foreach (IPreUpdateEventListener listener in preListeners) { veto |= listener.OnPreUpdate(preEvent); Modified: trunk/nhibernate/src/NHibernate/Event/AbstractEvent.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Event/AbstractEvent.cs 2009-05-06 22:59:51 UTC (rev 4256) +++ trunk/nhibernate/src/NHibernate/Event/AbstractEvent.cs 2009-05-07 03:34:37 UTC (rev 4257) @@ -8,24 +8,19 @@ [Serializable] public class AbstractEvent { - private readonly IEventSource session; - /// <summary> /// Constructs an event from the given event session. /// </summary> /// <param name="source">The session event source. </param> public AbstractEvent(IEventSource source) { - session = source; + Session = source; } /// <summary> /// Returns the session event source for this event. /// This is the underlying session from which this event was generated. /// </summary> - public IEventSource Session - { - get { return session; } - } + public IEventSource Session { get; private set; } } } \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Event/AbstractPreDatabaseOperationEvent.cs 2009-05-07 03:34:37 UTC (rev 4257) @@ -0,0 +1,43 @@ +using System; +using NHibernate.Engine; +using NHibernate.Persister.Entity; + +namespace NHibernate.Event +{ + /// <summary> + /// Represents an operation we are about to perform against the database. + /// </summary> + [Serializable] + public abstract class AbstractPreDatabaseOperationEvent : AbstractEvent + { + /// <summary> Constructs an event containing the pertinent information. </summary> + /// <param name="source">The session from which the event originated. </param> + /// <param name="entity">The entity to be invloved in the database operation. </param> + /// <param name="id">The entity id to be invloved in the database operation. </param> + /// <param name="persister">The entity's persister. </param> + protected AbstractPreDatabaseOperationEvent(IEventSource source, object entity, object id, IEntityPersister persister) + : base(source) + { + Entity = entity; + Id = id; + Persister = persister; + } + + /// <summary> The entity involved in the database operation. </summary> + public object Entity { get; private set; } + + /// <summary> The id to be used in the database operation. </summary> + public object Id { get; private set; } + + /// <summary> + /// The persister for the <see cref="Entity">. + /// </summary> + public IEntityPersister Persister { get; private set; } + + [Obsolete("Use Session property instead")] + public ISessionImplementor Source + { + get { return Session; } + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Event/PreDeleteEvent.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Event/PreDeleteEvent.cs 2009-05-06 22:59:51 UTC (rev 4256) +++ trunk/nhibernate/src/NHibernate/Event/PreDeleteEvent.cs 2009-05-07 03:34:37 UTC (rev 4257) @@ -3,41 +3,29 @@ namespace NHibernate.Event { /// <summary> - /// Occurs before deleting an item from the datastore + /// Represents a <tt>pre-delete</tt> event, which occurs just prior to + /// performing the deletion of an entity from the database. /// </summary> - public class PreDeleteEvent + public class PreDeleteEvent : AbstractPreDatabaseOperationEvent { - private readonly object entity; - private readonly object id; - private readonly object[] deletedState; - private readonly IEntityPersister persister; - - public PreDeleteEvent(object entity, object id, object[] deletedState, IEntityPersister persister) + /// <summary> + /// Constructs an event containing the pertinent information. + /// </summary> + /// <param name="entity">The entity to be deleted. </param> + /// <param name="id">The id to use in the deletion. </param> + /// <param name="deletedState">The entity's state at deletion time. </param> + /// <param name="persister">The entity's persister. </param> + /// <param name="source">The session from which the event originated. </param> + public PreDeleteEvent(object entity, object id, object[] deletedState, IEntityPersister persister, IEventSource source) + : base(source, entity, id, persister) { - this.entity = entity; - this.id = id; - this.deletedState = deletedState; - this.persister = persister; + DeletedState = deletedState; } - public object Entity - { - get { return entity; } - } - - public object Id - { - get { return id; } - } - - public object[] DeletedState - { - get { return deletedState; } - } - - public IEntityPersister Persister - { - get { return persister; } - } + /// <summary> + /// This is the entity state at the + /// time of deletion (useful for optomistic locking and such). + /// </summary> + public object[] DeletedState { get; private set; } } -} +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Event/PreInsertEvent.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Event/PreInsertEvent.cs 2009-05-06 22:59:51 UTC (rev 4256) +++ trunk/nhibernate/src/NHibernate/Event/PreInsertEvent.cs 2009-05-07 03:34:37 UTC (rev 4257) @@ -1,51 +1,22 @@ -using NHibernate.Engine; using NHibernate.Persister.Entity; namespace NHibernate.Event { /// <summary> - /// Occurs before inserting an item in the datastore + /// Represents a <tt>pre-insert</tt> event, which occurs just prior to + /// performing the insert of an entity into the database. /// </summary> - public class PreInsertEvent + public class PreInsertEvent : AbstractPreDatabaseOperationEvent { - private readonly object entity; - private readonly object id; - private readonly object[] state; - private readonly IEntityPersister persister; - private readonly ISessionImplementor source; - - public PreInsertEvent(object entity, object id, object[] state, IEntityPersister persister, ISessionImplementor source) + public PreInsertEvent(object entity, object id, object[] state, IEntityPersister persister, IEventSource source) + : base(source, entity, id, persister) { - this.entity = entity; - this.id = id; - this.state = state; - this.persister = persister; - this.source = source; + State = state; } - public object Entity - { - get { return entity; } - } - - public object Id - { - get { return id; } - } - - public object[] State - { - get { return state; } - } - - public IEntityPersister Persister - { - get { return persister; } - } - - public ISessionImplementor Source - { - get { return source; } - } + /// <summary> + /// These are the values to be inserted. + /// </summary> + public object[] State { get; private set; } } } Modified: trunk/nhibernate/src/NHibernate/Event/PreUpdateEvent.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Event/PreUpdateEvent.cs 2009-05-06 22:59:51 UTC (rev 4256) +++ trunk/nhibernate/src/NHibernate/Event/PreUpdateEvent.cs 2009-05-07 03:34:37 UTC (rev 4257) @@ -1,62 +1,29 @@ -using System; -using System.Collections.Generic; -using System.Text; -using NHibernate.Engine; using NHibernate.Persister.Entity; namespace NHibernate.Event { /// <summary> - /// Occurs before updating the datastore + /// Represents a <tt>pre-update</tt> event, which occurs just prior to + /// performing the update of an entity in the database. /// </summary> - public class PreUpdateEvent + public class PreUpdateEvent : AbstractPreDatabaseOperationEvent { - private readonly object entity; - private readonly object id; - private readonly object[] state; - private readonly object[] oldState; - private readonly IEntityPersister persister; - private readonly ISessionImplementor source; - - public PreUpdateEvent(object entity, object id, object[] state, object[] oldState, - IEntityPersister persister, ISessionImplementor source) + public PreUpdateEvent(object entity, object id, object[] state, object[] oldState, IEntityPersister persister, + IEventSource source) : base(source, entity, id, persister) { - this.entity = entity; - this.id = id; - this.state = state; - this.oldState = oldState; - this.persister = persister; - this.source = source; + State = state; + OldState = oldState; } - public object Entity - { - get { return entity; } - } + /// <summary> + /// Retrieves the state to be used in the update. + /// </summary> + public object[] State { get; private set; } - public object Id - { - get { return id; } - } - - public object[] State - { - get { return state; } - } - - public object[] OldState - { - get { return oldState; } - } - - public IEntityPersister Persister - { - get { return persister; } - } - - public ISessionImplementor Source - { - get { return source; } - } + /// <summary> + /// The old state of the entity at the time it was last loaded from the + /// database; can be null in the case of detached entities. + /// </summary> + public object[] OldState { get; private set; } } -} +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-05-06 22:59:51 UTC (rev 4256) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-05-07 03:34:37 UTC (rev 4257) @@ -471,6 +471,7 @@ <Compile Include="Driver\IfxDriver.cs" /> <Compile Include="Driver\OracleLiteDataClientDriver.cs" /> <Compile Include="EntityModeEqualityComparer.cs" /> + <Compile Include="Event\AbstractPreDatabaseOperationEvent.cs" /> <Compile Include="Event\IDestructible.cs" /> <Compile Include="Exceptions\ReflectionBasedSqlStateExtracter.cs" /> <Compile Include="Exceptions\SqlStateExtracter.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-06 22:59:57
|
Revision: 4256 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4256&view=rev Author: fabiomaulo Date: 2009-05-06 22:59:51 +0000 (Wed, 06 May 2009) Log Message: ----------- Minor (reformatting, removed warning, completed function) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs 2009-05-06 21:50:40 UTC (rev 4255) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/SqlGenerator.cs 2009-05-06 22:59:51 UTC (rev 4256) @@ -20,15 +20,8 @@ [CLSCompliant(false)] public partial class SqlGenerator : IErrorReporter { - /// <summary> - /// Handles parser errors. - /// </summary> - private readonly IParseErrorHandler _parseErrorHandler; + private readonly List<IParameterSpecification> collectedParameters = new List<IParameterSpecification>(); - private readonly ISessionFactoryImplementor _sessionFactory; - - private readonly List<IParameterSpecification> _collectedParameters = new List<IParameterSpecification>(); - /** * all append invocations on the buf should go through this Output instance variable. * The value of this variable may be temporarily substitued by sql function processing code @@ -36,131 +29,137 @@ * This is because sql function templates need arguments as seperate string chunks * that will be assembled into the target dialect-specific function call. */ - private ISqlWriter _writer; + private readonly List<ISqlWriter> outputStack = new List<ISqlWriter>(); - private readonly List<ISqlWriter> _outputStack = new List<ISqlWriter>(); + /// <summary> + /// Handles parser errors. + /// </summary> + private readonly IParseErrorHandler parseErrorHandler; - private readonly SqlStringBuilder _sqlStringBuilder = new SqlStringBuilder(); + private readonly ISessionFactoryImplementor sessionFactory; + private readonly SqlStringBuilder sqlStringBuilder = new SqlStringBuilder(); + private ISqlWriter writer; + public SqlGenerator(ISessionFactoryImplementor sfi, ITreeNodeStream input) : this(input) { - _parseErrorHandler = new ErrorCounter(); - _sessionFactory = sfi; - _writer = new DefaultWriter(this); + parseErrorHandler = new ErrorCounter(); + sessionFactory = sfi; + writer = new DefaultWriter(this); } - public override void ReportError(RecognitionException e) + public IParseErrorHandler ParseErrorHandler { - _parseErrorHandler.ReportError(e); // Use the delegate. + get { return parseErrorHandler; } } + #region IErrorReporter Members + + public override void ReportError(RecognitionException e) + { + parseErrorHandler.ReportError(e); // Use the delegate. + } + public void ReportError(String s) { - _parseErrorHandler.ReportError(s); // Use the delegate. + parseErrorHandler.ReportError(s); // Use the delegate. } public void ReportWarning(String s) { - _parseErrorHandler.ReportWarning(s); + parseErrorHandler.ReportWarning(s); } + #endregion + public SqlString GetSQL() { - return _sqlStringBuilder.ToSqlString(); + return sqlStringBuilder.ToSqlString(); } public IList<IParameterSpecification> GetCollectedParameters() { - return _collectedParameters; + return collectedParameters; } - public IParseErrorHandler ParseErrorHandler + private void Out(string s) { - get { return _parseErrorHandler; } + writer.Clause(s); } - private void Out(string s) + private void Out(SqlString s) { - _writer.Clause(s); + writer.Clause(s); } - private void Out(SqlString s) - { - _writer.Clause(s); - } - private void ParameterOut() { - _writer.Parameter(); + writer.Parameter(); } - /** - * Returns the last character written to the output, or -1 if there isn't one. - *//* - private int GetLastChar() + /// <summary> + /// Add a aspace if the previous token was not a space or a parenthesis. + /// </summary> + private void OptionalSpace() { - int len = _buf.Length; - if ( len == 0 ) - return -1; + int len = sqlStringBuilder.Count; + if (len == 0) + { + return; + } else - return _buf[len - 1]; - }*/ - - /** - * Add a aspace if the previous token was not a space or a parenthesis. - */ - void OptionalSpace() - {/* - int c = GetLastChar(); - switch ( c ) { - case -1: + { + string lastPart = sqlStringBuilder[len - 1].ToString(); + if (lastPart.Length == 0) + { return; - case ' ': - return; - case ')': - return; - case '(': - return; - default: - Out( " " ); - break; - }*/ + } + switch (lastPart[lastPart.Length - 1]) + { + case ' ': + return; + case ')': + return; + case '(': + return; + } + } Out(" "); } - private void Out(IASTNode n) + private void Out(IASTNode n) { if (n is ParameterNode) { ParameterOut(); } - else if ( n is SqlNode ) + else if (n is SqlNode) { - Out(((SqlNode) n).RenderText(_sessionFactory)); + Out(((SqlNode) n).RenderText(sessionFactory)); } - else + else { Out(n.Text); } - if ( n is ParameterNode ) + if (n is ParameterNode) { - _collectedParameters.Add( ( ( ParameterNode ) n ).HqlParameterSpecification ); + collectedParameters.Add(((ParameterNode) n).HqlParameterSpecification); } - else if ( n is IParameterContainer ) + else if (n is IParameterContainer) { - if ( ( ( IParameterContainer ) n ).HasEmbeddedParameters ) + if (((IParameterContainer) n).HasEmbeddedParameters) { - IParameterSpecification[] specifications = ( ( IParameterContainer ) n ).GetEmbeddedParameters(); - if ( specifications != null ) + IParameterSpecification[] specifications = ((IParameterContainer) n).GetEmbeddedParameters(); + if (specifications != null) { - _collectedParameters.AddRange(specifications); + collectedParameters.AddRange(specifications); } } } } - private void Separator(IASTNode n, String sep) + private void Separator(IASTNode n, String sep) { if (n.NextSibling != null) { @@ -168,22 +167,22 @@ } } - private static bool HasText(IASTNode a) + private static bool HasText(IASTNode a) { return !string.IsNullOrEmpty(a.Text); } - protected virtual void FromFragmentSeparator(IASTNode a) + protected virtual void FromFragmentSeparator(IASTNode a) { // check two "adjecent" nodes at the top of the from-clause tree IASTNode next = a.NextSibling; - if ( next == null || !HasText( a ) ) + if (next == null || !HasText(a)) { return; } - FromElement left = ( FromElement ) a; - FromElement right = ( FromElement ) next; + var left = (FromElement) a; + var right = (FromElement) next; /////////////////////////////////////////////////////////////////////// // HACK ALERT !!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -194,40 +193,39 @@ // // Essentially, look-ahead to the next FromElement that actually // writes something to the SQL - while ( right != null && !HasText( right ) ) + while (right != null && !HasText(right)) { - right = ( FromElement ) right.NextSibling; + right = (FromElement) right.NextSibling; } - if ( right == null ) + if (right == null) { return; } /////////////////////////////////////////////////////////////////////// - if ( !HasText( right ) ) + if (!HasText(right)) { return; } - if ( right.RealOrigin == left || - ( right.RealOrigin != null && right.RealOrigin == left.RealOrigin ) ) + if (right.RealOrigin == left || (right.RealOrigin != null && right.RealOrigin == left.RealOrigin)) { // right represents a joins originating from left; or // both right and left reprersent joins originating from the same FromElement - if ( right.JoinSequence != null && right.JoinSequence.IsThetaStyle) + if (right.JoinSequence != null && right.JoinSequence.IsThetaStyle) { - Out( ", " ); + Out(", "); } - else + else { - Out( " " ); + Out(" "); } } - else + else { // these are just two unrelated table references - Out( ", " ); + Out(", "); } } @@ -240,8 +238,8 @@ if (parent != null && HasText(parent)) { // again, both should be FromElements - FromElement left = (FromElement) parent; - FromElement right = (FromElement) d; + var left = (FromElement) parent; + var right = (FromElement) d; if (right.RealOrigin == left) { // right represents a joins originating from left... @@ -268,12 +266,12 @@ private SqlStringBuilder GetStringBuilder() { - return _sqlStringBuilder; + return sqlStringBuilder; } - private void BeginFunctionTemplate(IASTNode m, IASTNode i) + private void BeginFunctionTemplate(IASTNode m, IASTNode i) { - MethodNode methodNode = (MethodNode)m; + var methodNode = (MethodNode) m; ISQLFunction template = methodNode.SQLFunction; if (template == null) { @@ -284,126 +282,142 @@ else { // this function has a template -> redirect output and catch the arguments - _outputStack.Insert(0, _writer); - _writer = new FunctionArguments(); + outputStack.Insert(0, writer); + writer = new FunctionArguments(); } } - private void EndFunctionTemplate(IASTNode m) + private void EndFunctionTemplate(IASTNode m) { - MethodNode methodNode = ( MethodNode ) m; + var methodNode = (MethodNode) m; ISQLFunction template = methodNode.SQLFunction; - if ( template == null ) + if (template == null) { - Out(")"); + Out(")"); } - else + else { // this function has a template -> restore output, apply the template and write the result out - FunctionArguments functionArguments = ( FunctionArguments ) _writer; // TODO: Downcast to avoid using an interface? Yuck. - _writer = _outputStack[0]; - _outputStack.RemoveAt(0); - Out( template.Render( functionArguments.Args, _sessionFactory) ); + var functionArguments = (FunctionArguments) writer; // TODO: Downcast to avoid using an interface? Yuck. + writer = outputStack[0]; + outputStack.RemoveAt(0); + Out(template.Render(functionArguments.Args, sessionFactory)); } } - private void CommaBetweenParameters(String comma) + private void CommaBetweenParameters(String comma) { - _writer.CommaBetweenParameters(comma); + writer.CommaBetweenParameters(comma); } - /** - * Writes SQL fragments. - */ - interface ISqlWriter - { - void Clause(String clause); - void Clause(SqlString clause); - void Parameter(); - /** - * todo remove this hack - * The parameter is either ", " or " , ". This is needed to pass sql generating tests as the old - * sql generator uses " , " in the WHERE and ", " in SELECT. - * - * @param comma either " , " or ", " - */ - void CommaBetweenParameters(String comma); - } - /** - * SQL function processing code redirects generated SQL output to an instance of this class - * which catches function arguments. - */ - class FunctionArguments : ISqlWriter + #region Nested type: DefaultWriter + + /// <summary> + /// The default SQL writer. + /// </summary> + private class DefaultWriter : ISqlWriter { - private int argInd; - private readonly List<object> args = new List<object>(); + private readonly SqlGenerator generator; - public void Clause(String clause) + internal DefaultWriter(SqlGenerator generator) { - if (argInd == args.Count) - { - args.Add(clause); - } - else - { - args[argInd] = args[argInd] + clause; - } + this.generator = generator; } - public void Clause(SqlString clause) - { - this.Clause(clause.ToString()); - } + #region ISqlWriter Members + public void Clause(String clause) + { + generator.GetStringBuilder().Add(clause); + } + + public void Clause(SqlString clause) + { + generator.GetStringBuilder().Add(clause); + } + public void Parameter() { - args.Add(SqlCommand.Parameter.Placeholder); + generator.GetStringBuilder().AddParameter(); } - public void CommaBetweenParameters(String comma) + public void CommaBetweenParameters(String comma) { - ++argInd; + generator.GetStringBuilder().Add(comma); } + #endregion + } + + #endregion + + #region Nested type: FunctionArguments + + private class FunctionArguments : ISqlWriter + { + private readonly List<object> args = new List<object>(); + private int argInd; + public IList Args { get { return args; } } - } - /** - * The default SQL writer. - */ - class DefaultWriter : ISqlWriter - { - private readonly SqlGenerator _generator; + #region ISqlWriter Members - internal DefaultWriter(SqlGenerator generator) + public void Clause(string clause) { - _generator = generator; + if (argInd == args.Count) + { + args.Add(clause); + } + else + { + args[argInd] = args[argInd] + clause; + } } - public void Clause(String clause) + public void Clause(SqlString clause) { - _generator.GetStringBuilder().Add( clause ); + Clause(clause.ToString()); } - public void Clause(SqlString clause) - { - _generator.GetStringBuilder().Add(clause); - } - public void Parameter() { - _generator.GetStringBuilder().AddParameter(); + args.Add(SqlCommand.Parameter.Placeholder); } - - public void CommaBetweenParameters(String comma) + public void CommaBetweenParameters(string comma) { - _generator.GetStringBuilder().Add(comma); + ++argInd; } + + #endregion } + + #endregion + + #region Nested type: ISqlWriter + + /// <summary> + /// Writes SQL fragments. + /// </summary> + private interface ISqlWriter + { + void Clause(string clause); + void Clause(SqlString clause); + void Parameter(); + /** + * todo remove this hack + * The parameter is either ", " or " , ". This is needed to pass sql generating tests as the old + * sql generator uses " , " in the WHERE and ", " in SELECT. + * + * @param comma either " , " or ", " + */ + void CommaBetweenParameters(string comma); + } + + #endregion } -} +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-06 21:50:47
|
Revision: 4255 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4255&view=rev Author: fabiomaulo Date: 2009-05-06 21:50:40 +0000 (Wed, 06 May 2009) Log Message: ----------- Starting port of AST tests for Inserts Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlSqlWalker.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/IntoClause.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlSqlWalker.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlSqlWalker.cs 2009-05-06 16:10:29 UTC (rev 4254) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlSqlWalker.cs 2009-05-06 21:50:40 UTC (rev 4255) @@ -1,4 +1,4 @@ -// $ANTLR 3.1.2 C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g 2009-05-05 16:13:02 +// $ANTLR 3.1.2 C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g 2009-05-06 18:27:40 // The variable 'variable' is assigned but its value is never used. #pragma warning disable 168, 219 @@ -665,16 +665,16 @@ // AST REWRITE - // elements: w, u, s, f + // elements: u, f, s, w // token labels: u - // rule labels: f, w, retval, s + // rule labels: w, f, retval, s // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; RewriteRuleNodeStream stream_u = new RewriteRuleNodeStream(adaptor, "token u", u); + RewriteRuleSubtreeStream stream_w = new RewriteRuleSubtreeStream(adaptor, "rule w", w!=null ? w.Tree : null); RewriteRuleSubtreeStream stream_f = new RewriteRuleSubtreeStream(adaptor, "rule f", f!=null ? f.Tree : null); - RewriteRuleSubtreeStream stream_w = new RewriteRuleSubtreeStream(adaptor, "rule w", w!=null ? w.Tree : null); RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null); RewriteRuleSubtreeStream stream_s = new RewriteRuleSubtreeStream(adaptor, "rule s", s!=null ? s.Tree : null); @@ -956,8 +956,8 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:84:2: ( ^( INTO (p= path ) ps= insertablePropertySpec ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:84:4: ^( INTO (p= path ) ps= insertablePropertySpec ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:87:2: ( ^( INTO (p= path ) ps= insertablePropertySpec ) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:87:4: ^( INTO (p= path ) ps= insertablePropertySpec ) { root_0 = (IASTNode)adaptor.GetNilNode(); @@ -966,7 +966,7 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - INTO12=(IASTNode)Match(input,INTO,FOLLOW_INTO_in_intoClause341); + INTO12=(IASTNode)Match(input,INTO,FOLLOW_INTO_in_intoClause347); INTO12_tree = (IASTNode)adaptor.DupNode(INTO12); root_1 = (IASTNode)adaptor.BecomeRoot(INTO12_tree, root_1); @@ -975,11 +975,11 @@ HandleClauseStart( INTO ); Match(input, Token.DOWN, null); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:84:43: (p= path ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:84:44: p= path + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:87:43: (p= path ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:87:44: p= path { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_path_in_intoClause348); + PushFollow(FOLLOW_path_in_intoClause354); p = path(); state.followingStackPointer--; @@ -988,7 +988,7 @@ } _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_insertablePropertySpec_in_intoClause353); + PushFollow(FOLLOW_insertablePropertySpec_in_intoClause359); ps = insertablePropertySpec(); state.followingStackPointer--; @@ -998,13 +998,13 @@ } - retval.Tree = CreateIntoClause(((p != null) ? p.p : default(String)), ((ps != null) ? ((IASTNode)ps.Tree) : null)); - - } retval.Tree = (IASTNode)adaptor.RulePostProcessing(root_0); + + retval.Tree = CreateIntoClause(((p != null) ? p.p : default(String)), ((ps != null) ? ((IASTNode)ps.Tree) : null)); + } catch (RecognitionException re) { @@ -1029,7 +1029,7 @@ }; // $ANTLR start "insertablePropertySpec" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:89:1: insertablePropertySpec : ^( RANGE ( IDENT )+ ) ; + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:90:1: insertablePropertySpec : ^( RANGE ( IDENT )+ ) ; public HqlSqlWalker.insertablePropertySpec_return insertablePropertySpec() // throws RecognitionException [1] { HqlSqlWalker.insertablePropertySpec_return retval = new HqlSqlWalker.insertablePropertySpec_return(); @@ -1048,8 +1048,8 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:90:2: ( ^( RANGE ( IDENT )+ ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:90:4: ^( RANGE ( IDENT )+ ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:91:2: ( ^( RANGE ( IDENT )+ ) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:91:4: ^( RANGE ( IDENT )+ ) { root_0 = (IASTNode)adaptor.GetNilNode(); @@ -1058,7 +1058,7 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - RANGE13=(IASTNode)Match(input,RANGE,FOLLOW_RANGE_in_insertablePropertySpec370); + RANGE13=(IASTNode)Match(input,RANGE,FOLLOW_RANGE_in_insertablePropertySpec375); RANGE13_tree = (IASTNode)adaptor.DupNode(RANGE13); root_1 = (IASTNode)adaptor.BecomeRoot(RANGE13_tree, root_1); @@ -1066,7 +1066,7 @@ Match(input, Token.DOWN, null); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:90:13: ( IDENT )+ + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:91:13: ( IDENT )+ int cnt5 = 0; do { @@ -1082,10 +1082,10 @@ switch (alt5) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:90:14: IDENT + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:91:14: IDENT { _last = (IASTNode)input.LT(1); - IDENT14=(IASTNode)Match(input,IDENT,FOLLOW_IDENT_in_insertablePropertySpec373); + IDENT14=(IASTNode)Match(input,IDENT,FOLLOW_IDENT_in_insertablePropertySpec378); IDENT14_tree = (IASTNode)adaptor.DupNode(IDENT14); adaptor.AddChild(root_1, IDENT14_tree); @@ -1139,7 +1139,7 @@ }; // $ANTLR start "setClause" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:93:1: setClause : ^( SET ( assignment )* ) ; + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:94:1: setClause : ^( SET ( assignment )* ) ; public HqlSqlWalker.setClause_return setClause() // throws RecognitionException [1] { HqlSqlWalker.setClause_return retval = new HqlSqlWalker.setClause_return(); @@ -1158,8 +1158,8 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:94:2: ( ^( SET ( assignment )* ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:94:4: ^( SET ( assignment )* ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:95:2: ( ^( SET ( assignment )* ) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:95:4: ^( SET ( assignment )* ) { root_0 = (IASTNode)adaptor.GetNilNode(); @@ -1168,7 +1168,7 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - SET15=(IASTNode)Match(input,SET,FOLLOW_SET_in_setClause390); + SET15=(IASTNode)Match(input,SET,FOLLOW_SET_in_setClause395); SET15_tree = (IASTNode)adaptor.DupNode(SET15); root_1 = (IASTNode)adaptor.BecomeRoot(SET15_tree, root_1); @@ -1179,7 +1179,7 @@ if ( input.LA(1) == Token.DOWN ) { Match(input, Token.DOWN, null); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:94:41: ( assignment )* + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:95:41: ( assignment )* do { int alt6 = 2; @@ -1194,10 +1194,10 @@ switch (alt6) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:94:42: assignment + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:95:42: assignment { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_assignment_in_setClause395); + PushFollow(FOLLOW_assignment_in_setClause400); assignment16 = assignment(); state.followingStackPointer--; @@ -1248,7 +1248,7 @@ }; // $ANTLR start "assignment" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:97:1: assignment : ^( EQ (p= propertyRef ) ( newValue ) ) ; + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:98:1: assignment : ^( EQ (p= propertyRef ) ( newValue ) ) ; public HqlSqlWalker.assignment_return assignment() // throws RecognitionException [1] { HqlSqlWalker.assignment_return retval = new HqlSqlWalker.assignment_return(); @@ -1269,8 +1269,8 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:103:2: ( ^( EQ (p= propertyRef ) ( newValue ) ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:103:4: ^( EQ (p= propertyRef ) ( newValue ) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:104:2: ( ^( EQ (p= propertyRef ) ( newValue ) ) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:104:4: ^( EQ (p= propertyRef ) ( newValue ) ) { root_0 = (IASTNode)adaptor.GetNilNode(); @@ -1279,7 +1279,7 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - EQ17=(IASTNode)Match(input,EQ,FOLLOW_EQ_in_assignment422); + EQ17=(IASTNode)Match(input,EQ,FOLLOW_EQ_in_assignment427); EQ17_tree = (IASTNode)adaptor.DupNode(EQ17); root_1 = (IASTNode)adaptor.BecomeRoot(EQ17_tree, root_1); @@ -1287,11 +1287,11 @@ Match(input, Token.DOWN, null); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:103:10: (p= propertyRef ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:103:11: p= propertyRef + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:104:10: (p= propertyRef ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:104:11: p= propertyRef { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_propertyRef_in_assignment427); + PushFollow(FOLLOW_propertyRef_in_assignment432); p = propertyRef(); state.followingStackPointer--; @@ -1300,11 +1300,11 @@ } Resolve(((p != null) ? ((IASTNode)p.Tree) : null)); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:103:48: ( newValue ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:103:49: newValue + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:104:48: ( newValue ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:104:49: newValue { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_newValue_in_assignment433); + PushFollow(FOLLOW_newValue_in_assignment438); newValue18 = newValue(); state.followingStackPointer--; @@ -1348,7 +1348,7 @@ }; // $ANTLR start "newValue" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:107:1: newValue : ( expr | query ); + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:108:1: newValue : ( expr | query ); public HqlSqlWalker.newValue_return newValue() // throws RecognitionException [1] { HqlSqlWalker.newValue_return retval = new HqlSqlWalker.newValue_return(); @@ -1367,7 +1367,7 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:108:2: ( expr | query ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:109:2: ( expr | query ) int alt7 = 2; int LA7_0 = input.LA(1); @@ -1389,12 +1389,12 @@ switch (alt7) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:108:4: expr + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:109:4: expr { root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_expr_in_newValue449); + PushFollow(FOLLOW_expr_in_newValue454); expr19 = expr(); state.followingStackPointer--; @@ -1403,12 +1403,12 @@ } break; case 2 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:108:11: query + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:109:11: query { root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_query_in_newValue453); + PushFollow(FOLLOW_query_in_newValue458); query20 = query(); state.followingStackPointer--; @@ -1444,7 +1444,7 @@ }; // $ANTLR start "query" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:113:1: query : ^( QUERY ^( SELECT_FROM f= fromClause (s= selectClause )? ) (w= whereClause )? (g= groupClause )? (o= orderClause )? ) -> ^( SELECT ( $s)? $f ( $w)? ( $g)? ( $o)? ) ; + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:114:1: query : ^( QUERY ^( SELECT_FROM f= fromClause (s= selectClause )? ) (w= whereClause )? (g= groupClause )? (o= orderClause )? ) -> ^( SELECT ( $s)? $f ( $w)? ( $g)? ( $o)? ) ; public HqlSqlWalker.query_return query() // throws RecognitionException [1] { HqlSqlWalker.query_return retval = new HqlSqlWalker.query_return(); @@ -1479,15 +1479,15 @@ RewriteRuleSubtreeStream stream_selectClause = new RewriteRuleSubtreeStream(adaptor,"rule selectClause"); try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:120:2: ( ^( QUERY ^( SELECT_FROM f= fromClause (s= selectClause )? ) (w= whereClause )? (g= groupClause )? (o= orderClause )? ) -> ^( SELECT ( $s)? $f ( $w)? ( $g)? ( $o)? ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:120:4: ^( QUERY ^( SELECT_FROM f= fromClause (s= selectClause )? ) (w= whereClause )? (g= groupClause )? (o= orderClause )? ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:121:2: ( ^( QUERY ^( SELECT_FROM f= fromClause (s= selectClause )? ) (w= whereClause )? (g= groupClause )? (o= orderClause )? ) -> ^( SELECT ( $s)? $f ( $w)? ( $g)? ( $o)? ) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:121:4: ^( QUERY ^( SELECT_FROM f= fromClause (s= selectClause )? ) (w= whereClause )? (g= groupClause )? (o= orderClause )? ) { _last = (IASTNode)input.LT(1); { IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - QUERY21=(IASTNode)Match(input,QUERY,FOLLOW_QUERY_in_query475); + QUERY21=(IASTNode)Match(input,QUERY,FOLLOW_QUERY_in_query480); stream_QUERY.Add(QUERY21); @@ -1499,19 +1499,19 @@ IASTNode _save_last_2 = _last; IASTNode _first_2 = null; IASTNode root_2 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - SELECT_FROM22=(IASTNode)Match(input,SELECT_FROM,FOLLOW_SELECT_FROM_in_query487); + SELECT_FROM22=(IASTNode)Match(input,SELECT_FROM,FOLLOW_SELECT_FROM_in_query492); stream_SELECT_FROM.Add(SELECT_FROM22); Match(input, Token.DOWN, null); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_fromClause_in_query495); + PushFollow(FOLLOW_fromClause_in_query500); f = fromClause(); state.followingStackPointer--; stream_fromClause.Add(f.Tree); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:124:5: (s= selectClause )? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:125:5: (s= selectClause )? int alt8 = 2; int LA8_0 = input.LA(1); @@ -1522,10 +1522,10 @@ switch (alt8) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:124:6: s= selectClause + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:125:6: s= selectClause { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_selectClause_in_query504); + PushFollow(FOLLOW_selectClause_in_query509); s = selectClause(); state.followingStackPointer--; @@ -1540,7 +1540,7 @@ Match(input, Token.UP, null); adaptor.AddChild(root_1, root_2);_last = _save_last_2; } - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:126:4: (w= whereClause )? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:127:4: (w= whereClause )? int alt9 = 2; int LA9_0 = input.LA(1); @@ -1551,10 +1551,10 @@ switch (alt9) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:126:5: w= whereClause + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:127:5: w= whereClause { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_whereClause_in_query519); + PushFollow(FOLLOW_whereClause_in_query524); w = whereClause(); state.followingStackPointer--; @@ -1565,7 +1565,7 @@ } - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:127:4: (g= groupClause )? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:128:4: (g= groupClause )? int alt10 = 2; int LA10_0 = input.LA(1); @@ -1576,10 +1576,10 @@ switch (alt10) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:127:5: g= groupClause + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:128:5: g= groupClause { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_groupClause_in_query529); + PushFollow(FOLLOW_groupClause_in_query534); g = groupClause(); state.followingStackPointer--; @@ -1590,7 +1590,7 @@ } - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:128:4: (o= orderClause )? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:129:4: (o= orderClause )? int alt11 = 2; int LA11_0 = input.LA(1); @@ -1601,10 +1601,10 @@ switch (alt11) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:128:5: o= orderClause + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:129:5: o= orderClause { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_orderClause_in_query539); + PushFollow(FOLLOW_orderClause_in_query544); o = orderClause(); state.followingStackPointer--; @@ -1622,29 +1622,29 @@ // AST REWRITE - // elements: s, f, g, w, o + // elements: s, o, w, f, g // token labels: - // rule labels: w, f, g, retval, s, o + // rule labels: f, w, g, retval, s, o // token list labels: // rule list labels: // wildcard labels: retval.Tree = root_0; + RewriteRuleSubtreeStream stream_f = new RewriteRuleSubtreeStream(adaptor, "rule f", f!=null ? f.Tree : null); RewriteRuleSubtreeStream stream_w = new RewriteRuleSubtreeStream(adaptor, "rule w", w!=null ? w.Tree : null); - RewriteRuleSubtreeStream stream_f = new RewriteRuleSubtreeStream(adaptor, "rule f", f!=null ? f.Tree : null); RewriteRuleSubtreeStream stream_g = new RewriteRuleSubtreeStream(adaptor, "rule g", g!=null ? g.Tree : null); RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null); RewriteRuleSubtreeStream stream_s = new RewriteRuleSubtreeStream(adaptor, "rule s", s!=null ? s.Tree : null); RewriteRuleSubtreeStream stream_o = new RewriteRuleSubtreeStream(adaptor, "rule o", o!=null ? o.Tree : null); root_0 = (IASTNode)adaptor.GetNilNode(); - // 130:2: -> ^( SELECT ( $s)? $f ( $w)? ( $g)? ( $o)? ) + // 131:2: -> ^( SELECT ( $s)? $f ( $w)? ( $g)? ( $o)? ) { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:130:5: ^( SELECT ( $s)? $f ( $w)? ( $g)? ( $o)? ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:131:5: ^( SELECT ( $s)? $f ( $w)? ( $g)? ( $o)? ) { IASTNode root_1 = (IASTNode)adaptor.GetNilNode(); root_1 = (IASTNode)adaptor.BecomeRoot((IASTNode)adaptor.Create(SELECT, "SELECT"), root_1); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:130:14: ( $s)? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:131:14: ( $s)? if ( stream_s.HasNext() ) { adaptor.AddChild(root_1, stream_s.NextTree()); @@ -1652,21 +1652,21 @@ } stream_s.Reset(); adaptor.AddChild(root_1, stream_f.NextTree()); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:130:21: ( $w)? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:131:21: ( $w)? if ( stream_w.HasNext() ) { adaptor.AddChild(root_1, stream_w.NextTree()); } stream_w.Reset(); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:130:25: ( $g)? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:131:25: ( $g)? if ( stream_g.HasNext() ) { adaptor.AddChild(root_1, stream_g.NextTree()); } stream_g.Reset(); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:130:29: ( $o)? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:131:29: ( $o)? if ( stream_o.HasNext() ) { adaptor.AddChild(root_1, stream_o.NextTree()); @@ -1714,7 +1714,7 @@ }; // $ANTLR start "orderClause" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:133:1: orderClause : ^( ORDER orderExprs ) ; + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:134:1: orderClause : ^( ORDER orderExprs ) ; public HqlSqlWalker.orderClause_return orderClause() // throws RecognitionException [1] { HqlSqlWalker.orderClause_return retval = new HqlSqlWalker.orderClause_return(); @@ -1733,8 +1733,8 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:134:2: ( ^( ORDER orderExprs ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:134:4: ^( ORDER orderExprs ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:135:2: ( ^( ORDER orderExprs ) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:135:4: ^( ORDER orderExprs ) { root_0 = (IASTNode)adaptor.GetNilNode(); @@ -1743,7 +1743,7 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - ORDER23=(IASTNode)Match(input,ORDER,FOLLOW_ORDER_in_orderClause584); + ORDER23=(IASTNode)Match(input,ORDER,FOLLOW_ORDER_in_orderClause589); ORDER23_tree = (IASTNode)adaptor.DupNode(ORDER23); root_1 = (IASTNode)adaptor.BecomeRoot(ORDER23_tree, root_1); @@ -1753,7 +1753,7 @@ Match(input, Token.DOWN, null); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_orderExprs_in_orderClause588); + PushFollow(FOLLOW_orderExprs_in_orderClause593); orderExprs24 = orderExprs(); state.followingStackPointer--; @@ -1791,7 +1791,7 @@ }; // $ANTLR start "orderExprs" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:137:1: orderExprs : expr ( ASCENDING | DESCENDING )? ( orderExprs )? ; + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:138:1: orderExprs : expr ( ASCENDING | DESCENDING )? ( orderExprs )? ; public HqlSqlWalker.orderExprs_return orderExprs() // throws RecognitionException [1] { HqlSqlWalker.orderExprs_return retval = new HqlSqlWalker.orderExprs_return(); @@ -1812,18 +1812,18 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:138:2: ( expr ( ASCENDING | DESCENDING )? ( orderExprs )? ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:138:4: expr ( ASCENDING | DESCENDING )? ( orderExprs )? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:139:2: ( expr ( ASCENDING | DESCENDING )? ( orderExprs )? ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:139:4: expr ( ASCENDING | DESCENDING )? ( orderExprs )? { root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_expr_in_orderExprs600); + PushFollow(FOLLOW_expr_in_orderExprs605); expr25 = expr(); state.followingStackPointer--; adaptor.AddChild(root_0, expr25.Tree); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:138:9: ( ASCENDING | DESCENDING )? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:139:9: ( ASCENDING | DESCENDING )? int alt12 = 2; int LA12_0 = input.LA(1); @@ -1860,7 +1860,7 @@ } - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:138:37: ( orderExprs )? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:139:37: ( orderExprs )? int alt13 = 2; int LA13_0 = input.LA(1); @@ -1871,10 +1871,10 @@ switch (alt13) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:138:38: orderExprs + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:139:38: orderExprs { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_orderExprs_in_orderExprs614); + PushFollow(FOLLOW_orderExprs_in_orderExprs619); orderExprs27 = orderExprs(); state.followingStackPointer--; @@ -1914,7 +1914,7 @@ }; // $ANTLR start "groupClause" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:141:1: groupClause : ^( GROUP ( expr )+ ( ^( HAVING logicalExpr ) )? ) ; + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:142:1: groupClause : ^( GROUP ( expr )+ ( ^( HAVING logicalExpr ) )? ) ; public HqlSqlWalker.groupClause_return groupClause() // throws RecognitionException [1] { HqlSqlWalker.groupClause_return retval = new HqlSqlWalker.groupClause_return(); @@ -1937,8 +1937,8 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:142:2: ( ^( GROUP ( expr )+ ( ^( HAVING logicalExpr ) )? ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:142:4: ^( GROUP ( expr )+ ( ^( HAVING logicalExpr ) )? ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:143:2: ( ^( GROUP ( expr )+ ( ^( HAVING logicalExpr ) )? ) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:143:4: ^( GROUP ( expr )+ ( ^( HAVING logicalExpr ) )? ) { root_0 = (IASTNode)adaptor.GetNilNode(); @@ -1947,7 +1947,7 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - GROUP28=(IASTNode)Match(input,GROUP,FOLLOW_GROUP_in_groupClause628); + GROUP28=(IASTNode)Match(input,GROUP,FOLLOW_GROUP_in_groupClause633); GROUP28_tree = (IASTNode)adaptor.DupNode(GROUP28); root_1 = (IASTNode)adaptor.BecomeRoot(GROUP28_tree, root_1); @@ -1956,7 +1956,7 @@ HandleClauseStart( GROUP ); Match(input, Token.DOWN, null); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:142:44: ( expr )+ + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:143:44: ( expr )+ int cnt14 = 0; do { @@ -1972,10 +1972,10 @@ switch (alt14) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:142:45: expr + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:143:45: expr { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_expr_in_groupClause633); + PushFollow(FOLLOW_expr_in_groupClause638); expr29 = expr(); state.followingStackPointer--; @@ -1996,7 +1996,7 @@ loop14: ; // Stops C# compiler whinging that label 'loop14' has no statements - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:142:52: ( ^( HAVING logicalExpr ) )? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:143:52: ( ^( HAVING logicalExpr ) )? int alt15 = 2; int LA15_0 = input.LA(1); @@ -2007,14 +2007,14 @@ switch (alt15) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:142:54: ^( HAVING logicalExpr ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:143:54: ^( HAVING logicalExpr ) { _last = (IASTNode)input.LT(1); { IASTNode _save_last_2 = _last; IASTNode _first_2 = null; IASTNode root_2 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - HAVING30=(IASTNode)Match(input,HAVING,FOLLOW_HAVING_in_groupClause640); + HAVING30=(IASTNode)Match(input,HAVING,FOLLOW_HAVING_in_groupClause645); HAVING30_tree = (IASTNode)adaptor.DupNode(HAVING30); root_2 = (IASTNode)adaptor.BecomeRoot(HAVING30_tree, root_2); @@ -2023,7 +2023,7 @@ Match(input, Token.DOWN, null); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_logicalExpr_in_groupClause642); + PushFollow(FOLLOW_logicalExpr_in_groupClause647); logicalExpr31 = logicalExpr(); state.followingStackPointer--; @@ -2071,7 +2071,7 @@ }; // $ANTLR start "selectClause" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:145:1: selectClause : ^( SELECT (d= DISTINCT )? x= selectExprList ) -> ^( SELECT_CLAUSE[\"{select clause}\"] ( $d)? $x) ; + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:146:1: selectClause : ^( SELECT (d= DISTINCT )? x= selectExprList ) -> ^( SELECT_CLAUSE[\"{select clause}\"] ( $d)? $x) ; public HqlSqlWalker.selectClause_return selectClause() // throws RecognitionException [1] { HqlSqlWalker.selectClause_return retval = new HqlSqlWalker.selectClause_return(); @@ -2094,22 +2094,22 @@ RewriteRuleSubtreeStream stream_selectExprList = new RewriteRuleSubtreeStream(adaptor,"rule selectExprList"); try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:146:2: ( ^( SELECT (d= DISTINCT )? x= selectExprList ) -> ^( SELECT_CLAUSE[\"{select clause}\"] ( $d)? $x) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:146:4: ^( SELECT (d= DISTINCT )? x= selectExprList ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:147:2: ( ^( SELECT (d= DISTINCT )? x= selectExprList ) -> ^( SELECT_CLAUSE[\"{select clause}\"] ( $d)? $x) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:147:4: ^( SELECT (d= DISTINCT )? x= selectExprList ) { _last = (IASTNode)input.LT(1); { IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - SELECT32=(IASTNode)Match(input,SELECT,FOLLOW_SELECT_in_selectClause661); + SELECT32=(IASTNode)Match(input,SELECT,FOLLOW_SELECT_in_selectClause666); stream_SELECT.Add(SELECT32); HandleClauseStart( SELECT ); BeforeSelectClause(); Match(input, Token.DOWN, null); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:146:68: (d= DISTINCT )? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:147:68: (d= DISTINCT )? int alt16 = 2; int LA16_0 = input.LA(1); @@ -2120,10 +2120,10 @@ switch (alt16) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:146:69: d= DISTINCT + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:147:69: d= DISTINCT { _last = (IASTNode)input.LT(1); - d=(IASTNode)Match(input,DISTINCT,FOLLOW_DISTINCT_in_selectClause668); + d=(IASTNode)Match(input,DISTINCT,FOLLOW_DISTINCT_in_selectClause673); stream_DISTINCT.Add(d); @@ -2133,7 +2133,7 @@ } _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_selectExprList_in_selectClause674); + PushFollow(FOLLOW_selectExprList_in_selectClause679); x = selectExprList(); state.followingStackPointer--; @@ -2157,14 +2157,14 @@ RewriteRuleSubtreeStream stream_x = new RewriteRuleSubtreeStream(adaptor, "rule x", x!=null ? x.Tree : null); root_0 = (IASTNode)adaptor.GetNilNode(); - // 147:2: -> ^( SELECT_CLAUSE[\"{select clause}\"] ( $d)? $x) + // 148:2: -> ^( SELECT_CLAUSE[\"{select clause}\"] ( $d)? $x) { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:147:5: ^( SELECT_CLAUSE[\"{select clause}\"] ( $d)? $x) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:148:5: ^( SELECT_CLAUSE[\"{select clause}\"] ( $d)? $x) { IASTNode root_1 = (IASTNode)adaptor.GetNilNode(); root_1 = (IASTNode)adaptor.BecomeRoot((IASTNode)adaptor.Create(SELECT_CLAUSE, "{select clause}"), root_1); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:147:40: ( $d)? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:148:40: ( $d)? if ( stream_d.HasNext() ) { adaptor.AddChild(root_1, stream_d.NextNode()); @@ -2207,7 +2207,7 @@ }; // $ANTLR start "selectExprList" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:150:1: selectExprList : ( selectExpr | aliasedSelectExpr )+ ; + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:151:1: selectExprList : ( selectExpr | aliasedSelectExpr )+ ; public HqlSqlWalker.selectExprList_return selectExprList() // throws RecognitionException [1] { HqlSqlWalker.selectExprList_return retval = new HqlSqlWalker.selectExprList_return(); @@ -2230,12 +2230,12 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:154:2: ( ( selectExpr | aliasedSelectExpr )+ ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:154:4: ( selectExpr | aliasedSelectExpr )+ + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:155:2: ( ( selectExpr | aliasedSelectExpr )+ ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:155:4: ( selectExpr | aliasedSelectExpr )+ { root_0 = (IASTNode)adaptor.GetNilNode(); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:154:4: ( selectExpr | aliasedSelectExpr )+ + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:155:4: ( selectExpr | aliasedSelectExpr )+ int cnt17 = 0; do { @@ -2255,10 +2255,10 @@ switch (alt17) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:154:6: selectExpr + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:155:6: selectExpr { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_selectExpr_in_selectExprList709); + PushFollow(FOLLOW_selectExpr_in_selectExprList714); selectExpr33 = selectExpr(); state.followingStackPointer--; @@ -2267,10 +2267,10 @@ } break; case 2 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:154:19: aliasedSelectExpr + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:155:19: aliasedSelectExpr { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_aliasedSelectExpr_in_selectExprList713); + PushFollow(FOLLOW_aliasedSelectExpr_in_selectExprList718); aliasedSelectExpr34 = aliasedSelectExpr(); state.followingStackPointer--; @@ -2323,7 +2323,7 @@ }; // $ANTLR start "aliasedSelectExpr" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:159:1: aliasedSelectExpr : ^( AS se= selectExpr i= identifier ) ; + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:160:1: aliasedSelectExpr : ^( AS se= selectExpr i= identifier ) ; public HqlSqlWalker.aliasedSelectExpr_return aliasedSelectExpr() // throws RecognitionException [1] { HqlSqlWalker.aliasedSelectExpr_return retval = new HqlSqlWalker.aliasedSelectExpr_return(); @@ -2344,8 +2344,8 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:164:2: ( ^( AS se= selectExpr i= identifier ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:164:4: ^( AS se= selectExpr i= identifier ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:165:2: ( ^( AS se= selectExpr i= identifier ) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:165:4: ^( AS se= selectExpr i= identifier ) { root_0 = (IASTNode)adaptor.GetNilNode(); @@ -2354,7 +2354,7 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - AS35=(IASTNode)Match(input,AS,FOLLOW_AS_in_aliasedSelectExpr737); + AS35=(IASTNode)Match(input,AS,FOLLOW_AS_in_aliasedSelectExpr742); AS35_tree = (IASTNode)adaptor.DupNode(AS35); root_1 = (IASTNode)adaptor.BecomeRoot(AS35_tree, root_1); @@ -2363,13 +2363,13 @@ Match(input, Token.DOWN, null); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_selectExpr_in_aliasedSelectExpr741); + PushFollow(FOLLOW_selectExpr_in_aliasedSelectExpr746); se = selectExpr(); state.followingStackPointer--; adaptor.AddChild(root_1, se.Tree); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_identifier_in_aliasedSelectExpr745); + PushFollow(FOLLOW_identifier_in_aliasedSelectExpr750); i = identifier(); state.followingStackPointer--; @@ -2411,7 +2411,7 @@ }; // $ANTLR start "selectExpr" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:167:1: selectExpr : (p= propertyRef | ^( ALL ar2= aliasRef ) | ^( OBJECT ar3= aliasRef ) | con= constructor | functionCall | count | collectionFunction | literal | arithmeticExpr | query ); + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:168:1: selectExpr : (p= propertyRef | ^( ALL ar2= aliasRef ) | ^( OBJECT ar3= aliasRef ) | con= constructor | functionCall | count | collectionFunction | literal | arithmeticExpr | query ); public HqlSqlWalker.selectExpr_return selectExpr() // throws RecognitionException [1] { HqlSqlWalker.selectExpr_return retval = new HqlSqlWalker.selectExpr_return(); @@ -2450,7 +2450,7 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:168:2: (p= propertyRef | ^( ALL ar2= aliasRef ) | ^( OBJECT ar3= aliasRef ) | con= constructor | functionCall | count | collectionFunction | literal | arithmeticExpr | query ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:169:2: (p= propertyRef | ^( ALL ar2= aliasRef ) | ^( OBJECT ar3= aliasRef ) | con= constructor | functionCall | count | collectionFunction | literal | arithmeticExpr | query ) int alt18 = 10; switch ( input.LA(1) ) { @@ -2528,12 +2528,12 @@ switch (alt18) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:168:4: p= propertyRef + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:169:4: p= propertyRef { root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_propertyRef_in_selectExpr760); + PushFollow(FOLLOW_propertyRef_in_selectExpr765); p = propertyRef(); state.followingStackPointer--; @@ -2543,7 +2543,7 @@ } break; case 2 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:169:4: ^( ALL ar2= aliasRef ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:170:4: ^( ALL ar2= aliasRef ) { root_0 = (IASTNode)adaptor.GetNilNode(); @@ -2552,7 +2552,7 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - ALL36=(IASTNode)Match(input,ALL,FOLLOW_ALL_in_selectExpr772); + ALL36=(IASTNode)Match(input,ALL,FOLLOW_ALL_in_selectExpr777); ALL36_tree = (IASTNode)adaptor.DupNode(ALL36); root_1 = (IASTNode)adaptor.BecomeRoot(ALL36_tree, root_1); @@ -2561,7 +2561,7 @@ Match(input, Token.DOWN, null); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_aliasRef_in_selectExpr776); + PushFollow(FOLLOW_aliasRef_in_selectExpr781); ar2 = aliasRef(); state.followingStackPointer--; @@ -2575,7 +2575,7 @@ } break; case 3 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:170:4: ^( OBJECT ar3= aliasRef ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:171:4: ^( OBJECT ar3= aliasRef ) { root_0 = (IASTNode)adaptor.GetNilNode(); @@ -2584,7 +2584,7 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - OBJECT37=(IASTNode)Match(input,OBJECT,FOLLOW_OBJECT_in_selectExpr788); + OBJECT37=(IASTNode)Match(input,OBJECT,FOLLOW_OBJECT_in_selectExpr793); OBJECT37_tree = (IASTNode)adaptor.DupNode(OBJECT37); root_1 = (IASTNode)adaptor.BecomeRoot(OBJECT37_tree, root_1); @@ -2593,7 +2593,7 @@ Match(input, Token.DOWN, null); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_aliasRef_in_selectExpr792); + PushFollow(FOLLOW_aliasRef_in_selectExpr797); ar3 = aliasRef(); state.followingStackPointer--; @@ -2607,12 +2607,12 @@ } break; case 4 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:171:4: con= constructor + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:172:4: con= constructor { root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_constructor_in_selectExpr803); + PushFollow(FOLLOW_constructor_in_selectExpr808); con = constructor(); state.followingStackPointer--; @@ -2622,12 +2622,12 @@ } break; case 5 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:172:4: functionCall + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:173:4: functionCall { root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_functionCall_in_selectExpr814); + PushFollow(FOLLOW_functionCall_in_selectExpr819); functionCall38 = functionCall(); state.followingStackPointer--; @@ -2636,12 +2636,12 @@ } break; case 6 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:173:4: count + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:174:4: count { root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_count_in_selectExpr819); + PushFollow(FOLLOW_count_in_selectExpr824); count39 = count(); state.followingStackPointer--; @@ -2650,12 +2650,12 @@ } break; case 7 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:174:4: collectionFunction + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:175:4: collectionFunction { root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_collectionFunction_in_selectExpr824); + PushFollow(FOLLOW_collectionFunction_in_selectExpr829); collectionFunction40 = collectionFunction(); state.followingStackPointer--; @@ -2664,12 +2664,12 @@ } break; case 8 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:175:4: literal + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:176:4: literal { root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_literal_in_selectExpr832); + PushFollow(FOLLOW_literal_in_selectExpr837); literal41 = literal(); state.followingStackPointer--; @@ -2678,12 +2678,12 @@ } break; case 9 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:176:4: arithmeticExpr + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:177:4: arithmeticExpr { root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_arithmeticExpr_in_selectExpr837); + PushFollow(FOLLOW_arithmeticExpr_in_selectExpr842); arithmeticExpr42 = arithmeticExpr(); state.followingStackPointer--; @@ -2692,12 +2692,12 @@ } break; case 10 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:177:4: query + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:178:4: query { root_0 = (IASTNode)adaptor.GetNilNode(); _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_query_in_selectExpr842); + PushFollow(FOLLOW_query_in_selectExpr847); query43 = query(); state.followingStackPointer--; @@ -2733,7 +2733,7 @@ }; // $ANTLR start "count" - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:180:1: count : ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) ) ; + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:181:1: count : ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) ) ; public HqlSqlWalker.count_return count() // throws RecognitionException [1] { HqlSqlWalker.count_return retval = new HqlSqlWalker.count_return(); @@ -2756,8 +2756,8 @@ try { - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:181:2: ( ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) ) ) - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:181:4: ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:182:2: ( ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) ) ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:182:4: ^( COUNT ( DISTINCT | ALL )? ( aggregateExpr | ROW_STAR ) ) { root_0 = (IASTNode)adaptor.GetNilNode(); @@ -2766,7 +2766,7 @@ IASTNode _save_last_1 = _last; IASTNode _first_1 = null; IASTNode root_1 = (IASTNode)adaptor.GetNilNode();_last = (IASTNode)input.LT(1); - COUNT44=(IASTNode)Match(input,COUNT,FOLLOW_COUNT_in_count854); + COUNT44=(IASTNode)Match(input,COUNT,FOLLOW_COUNT_in_count859); COUNT44_tree = (IASTNode)adaptor.DupNode(COUNT44); root_1 = (IASTNode)adaptor.BecomeRoot(COUNT44_tree, root_1); @@ -2774,7 +2774,7 @@ Match(input, Token.DOWN, null); - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:181:12: ( DISTINCT | ALL )? + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:182:12: ( DISTINCT | ALL )? int alt19 = 2; int LA19_0 = input.LA(1); @@ -2811,7 +2811,7 @@ } - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:181:32: ( aggregateExpr | ROW_STAR ) + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:182:32: ( aggregateExpr | ROW_STAR ) int alt20 = 2; int LA20_0 = input.LA(1); @@ -2833,10 +2833,10 @@ switch (alt20) { case 1 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:181:34: aggregateExpr + // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g:182:34: aggregateExpr { _last = (IASTNode)input.LT(1); - PushFollow(FOLLOW_aggregateExpr_in_count869); + PushFollow(FOLLOW_aggregateExpr_in_count874); aggregateExpr46 = aggregateExpr(); state.followingStackPointer--; @@ -2845,10 +2845,10 @@ } break; case 2 : - // C:\\CSharp\\NH\\nhibernate\\src\\NHibernate\\Hql\\Ast\\ANTLR\\HqlSqlWalker.g... [truncated message content] |
From: <fab...@us...> - 2009-05-06 16:10:30
|
Revision: 4254 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4254&view=rev Author: fabiomaulo Date: 2009-05-06 16:10:29 +0000 (Wed, 06 May 2009) Log Message: ----------- End porting tests for UPDATE executable HQL Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/AssignmentSpecification.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/AssignmentSpecification.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/AssignmentSpecification.cs 2009-05-06 14:54:55 UTC (rev 4253) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/AssignmentSpecification.cs 2009-05-06 16:10:29 UTC (rev 4254) @@ -37,7 +37,16 @@ // knows about the property-ref path in the correct format; it is either this, or // recurse over the DotNodes constructing the property path just like DotNode does // internally - var lhs = (DotNode)eq.GetFirstChild(); + DotNode lhs; + try + { + lhs = (DotNode)eq.GetFirstChild(); + } + catch (InvalidCastException e) + { + throw new QueryException( + string.Format("Left side of assigment should be a case sensitive property or a field (depending on mapping); found '{0}'", eq.GetFirstChild()), e); + } var rhs = (SqlNode)lhs.NextSibling; ValidateLhs(lhs); Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-06 14:54:55 UTC (rev 4253) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-06 16:10:29 UTC (rev 4254) @@ -357,6 +357,86 @@ s.Close(); data.Cleanup(); + } + + [Test] + public void UpdateSetNullUnionSubclass() + { + var data = new TestData(this); + data.Prepare(); + + // These should reach out into *all* subclass tables... + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + int count = s.CreateQuery("update Vehicle set Owner = 'Steve'").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(4), "incorrect restricted update count"); + count = s.CreateQuery("update Vehicle set Owner = null where Owner = 'Steve'").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(4), "incorrect restricted update count"); + + count = s.CreateQuery("delete Vehicle where Owner is null").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(4), "incorrect restricted update count"); + + t.Commit(); + s.Close(); + + data.Cleanup(); + } + + [Test] + public void WrongPropertyNameThrowQueryException() + { + using (ISession s = OpenSession()) + { + var e = Assert.Throws<QueryException>(() => s.CreateQuery("update Vehicle set owner = null where owner = 'Steve'").ExecuteUpdate()); + Assert.That(e.Message, Text.StartsWith("Left side of assigment should be a case sensitive property or a field")); + } + } + + [Test] + public void UpdateSetNullOnDiscriminatorSubclass() + { + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + int count = s.CreateQuery("update PettingZoo set address.city = null").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect discrim subclass delete count"); + count = s.CreateQuery("delete Zoo where address.city is null").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect discrim subclass delete count"); + + count = s.CreateQuery("update Zoo set address.city = null").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect discrim subclass delete count"); + count = s.CreateQuery("delete Zoo where address.city is null").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect discrim subclass delete count"); + + t.Commit(); + s.Close(); + + data.Cleanup(); + } + + [Test] + public void UpdateSetNullOnJoinedSubclass() + { + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + int count = s.CreateQuery("update Mammal set bodyWeight = null").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(2), "Incorrect deletion count on joined subclass"); + + count = s.CreateQuery("delete Animal where bodyWeight = null").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(2), "Incorrect deletion count on joined subclass"); + + t.Commit(); + s.Close(); + + data.Cleanup(); } #endregion This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-06 14:54:57
|
Revision: 4253 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4253&view=rev Author: fabiomaulo Date: 2009-05-06 14:54:55 +0000 (Wed, 06 May 2009) Log Message: ----------- Continue port of AST tests for Updates (base entity) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-06 14:38:06 UTC (rev 4252) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-06 14:54:55 UTC (rev 4253) @@ -262,9 +262,9 @@ t.Rollback(); t = s.BeginTransaction(); - count = s.CreateQuery("update PettingZoo pz set pz.name = pz.name where pz.id = :id") - .SetInt64("id", data.PettingZoo.Id) - .ExecuteUpdate(); + count = + s.CreateQuery("update PettingZoo pz set pz.name = pz.name where pz.id = :id").SetInt64("id", data.PettingZoo.Id). + ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "Incorrect discrim subclass update count"); t.Rollback(); @@ -278,9 +278,7 @@ // TODO : not so sure this should be allowed. Seems to me that if they specify an alias, // property-refs should be required to be qualified. - count = s.CreateQuery("update Zoo as z set name = name where id = :id") - .SetInt64("id", data.Zoo.Id) - .ExecuteUpdate(); + count = s.CreateQuery("update Zoo as z set name = name where id = :id").SetInt64("id", data.Zoo.Id).ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "Incorrect discrim subclass update count"); t.Commit(); @@ -289,6 +287,78 @@ data.Cleanup(); } + [Test] + public void UpdateOnAnimal() + { + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + int count = + s.CreateQuery("update Animal set description = description where description = :desc") + .SetString("desc", data.Frog.Description) + .ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect entity-updated count"); + + count = + s.CreateQuery("update Animal set description = :newDesc where description = :desc") + .SetString("desc",data.Polliwog.Description) + .SetString("newDesc", "Tadpole") + .ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect entity-updated count"); + + var tadpole = s.Load<Animal>(data.Polliwog.Id); + + Assert.That(tadpole.Description, Is.EqualTo("Tadpole"), "Update did not take effect"); + + count = + s.CreateQuery("update Animal set bodyWeight = bodyWeight + :w1 + :w2") + .SetDouble("w1", 1) + .SetDouble("w2", 2) + .ExecuteUpdate(); + Assert.That(count, Is.EqualTo(6), "incorrect count on 'complex' update assignment"); + + if (! (Dialect is MySQLDialect)) + { + // MySQL does not support (even un-correlated) subqueries against the update-mutating table + s.CreateQuery("update Animal set bodyWeight = ( select max(bodyWeight) from Animal )").ExecuteUpdate(); + } + + t.Commit(); + s.Close(); + + data.Cleanup(); + } + + [Test] + public void UpdateOnMammal() + { + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + int count = s.CreateQuery("update Mammal set description = description").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(2), "incorrect update count against 'middle' of joined-subclass hierarchy"); + + count = s.CreateQuery("update Mammal set bodyWeight = 25").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(2), "incorrect update count against 'middle' of joined-subclass hierarchy"); + + if (! (Dialect is MySQLDialect)) + { + // MySQL does not support (even un-correlated) subqueries against the update-mutating table + count = s.CreateQuery("update Mammal set bodyWeight = ( select max(bodyWeight) from Animal )").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(2), "incorrect update count against 'middle' of joined-subclass hierarchy"); + } + + t.Commit(); + s.Close(); + + data.Cleanup(); + } + #endregion #region DELETES This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-06 14:38:07
|
Revision: 4252 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4252&view=rev Author: fabiomaulo Date: 2009-05-06 14:38:06 +0000 (Wed, 06 May 2009) Log Message: ----------- Continue port of AST tests for Updates (Discriminator entity) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-06 14:32:08 UTC (rev 4251) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-06 14:38:06 UTC (rev 4252) @@ -245,6 +245,48 @@ s.CreateQuery("delete Human").ExecuteUpdate(); t.Commit(); s.Close(); + } + + [Test] + public void UpdateOnDiscriminatorSubclass() + { + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + int count = s.CreateQuery("update PettingZoo set name = name").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect discrim subclass update count"); + + t.Rollback(); + t = s.BeginTransaction(); + + count = s.CreateQuery("update PettingZoo pz set pz.name = pz.name where pz.id = :id") + .SetInt64("id", data.PettingZoo.Id) + .ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect discrim subclass update count"); + + t.Rollback(); + t = s.BeginTransaction(); + + count = s.CreateQuery("update Zoo as z set z.name = z.name").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(2), "Incorrect discrim subclass update count"); + + t.Rollback(); + t = s.BeginTransaction(); + + // TODO : not so sure this should be allowed. Seems to me that if they specify an alias, + // property-refs should be required to be qualified. + count = s.CreateQuery("update Zoo as z set name = name where id = :id") + .SetInt64("id", data.Zoo.Id) + .ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect discrim subclass update count"); + + t.Commit(); + s.Close(); + + data.Cleanup(); } #endregion This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-06 14:32:13
|
Revision: 4251 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4251&view=rev Author: fabiomaulo Date: 2009-05-06 14:32:08 +0000 (Wed, 06 May 2009) Log Message: ----------- Continue port of AST tests for Updates (Implicit join fails) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-06 14:22:12 UTC (rev 4250) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-06 14:32:08 UTC (rev 4251) @@ -1,15 +1,14 @@ using System; using System.Collections; -using System.Diagnostics; using System.Threading; using NHibernate.Dialect; +using NHibernate.Hql.Ast.ANTLR; using NUnit.Framework; -using NHibernate.Hql.Ast.ANTLR; namespace NHibernate.Test.HQL.Ast { [TestFixture] - public class BulkManipulation: BaseFixture + public class BulkManipulation : BaseFixture { public ISession OpenNewSession() { @@ -32,19 +31,22 @@ { using (ISession s = OpenSession()) { - Assert.Throws<QuerySyntaxException>(() => s.CreateQuery("update NonExistentEntity e set e.someProp = ?").ExecuteUpdate()); + Assert.Throws<QuerySyntaxException>( + () => s.CreateQuery("update NonExistentEntity e set e.someProp = ?").ExecuteUpdate()); } } #endregion #region UPDATES + [Test] public void IncorrectSyntax() { - using(ISession s = OpenSession()) + using (ISession s = OpenSession()) { - Assert.Throws<QueryException>(() => s.CreateQuery("update Human set Human.description = 'xyz' where Human.id = 1 and Human.description is null")); + Assert.Throws<QueryException>( + () => s.CreateQuery("update Human set Human.description = 'xyz' where Human.id = 1 and Human.description is null")); } } @@ -90,20 +92,19 @@ t = s.BeginTransaction(); // one-to-many test updateQryString = "update SimpleEntityWithAssociation e set e.Name = 'updated' where " - + "exists(select a.id from e.AssociatedEntities a " - + "where a.Name = 'one-to-many-association')"; + + "exists(select a.id from e.AssociatedEntities a " + "where a.Name = 'one-to-many-association')"; count = s.CreateQuery(updateQryString).ExecuteUpdate(); Assert.That(count, Is.EqualTo(1)); // many-to-many test if (Dialect.SupportsSubqueryOnMutatingTable) { updateQryString = "update SimpleEntityWithAssociation e set e.Name = 'updated' where " - + "exists(select a.id from e.ManyToManyAssociatedEntities a " + + "exists(select a.id from e.ManyToManyAssociatedEntities a " + "where a.Name = 'many-to-many-association')"; count = s.CreateQuery(updateQryString).ExecuteUpdate(); Assert.That(count, Is.EqualTo(1)); } - var mtm = entity.ManyToManyAssociatedEntities.GetEnumerator(); + IEnumerator mtm = entity.ManyToManyAssociatedEntities.GetEnumerator(); mtm.MoveNext(); s.Delete(mtm.Current); s.Delete(entity); @@ -117,7 +118,7 @@ ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); - var entity = new IntegerVersioned{Name = "int-vers"}; + var entity = new IntegerVersioned {Name = "int-vers"}; s.Save(entity); t.Commit(); s.Close(); @@ -184,9 +185,8 @@ t = s.BeginTransaction(); int count = - s.CreateQuery("update Human set name.first = :correction where id = :id") - .SetString("correction", correctName) - .SetInt64("id", human.Id).ExecuteUpdate(); + s.CreateQuery("update Human set name.first = :correction where id = :id").SetString("correction", correctName). + SetInt64("id", human.Id).ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "incorrect update count"); t.Commit(); @@ -208,7 +208,7 @@ ITransaction t = s.BeginTransaction(); s.CreateQuery("update Animal a set a.mother = null where a.id = 2").ExecuteUpdate(); - if (! (Dialect is MySQLDialect) ) + if (! (Dialect is MySQLDialect)) { // MySQL does not support (even un-correlated) subqueries against the update-mutating table s.CreateQuery("update Animal a set a.mother = (from Animal where id = 1) where a.id = 2").ExecuteUpdate(); @@ -218,6 +218,35 @@ s.Close(); } + [Test] + public void UpdateOnImplicitJoinFails() + { + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + var human = new Human {Name = new Name {First = "Steve", Initial = 'E', Last = null}}; + + var mother = new Human {Name = new Name {First = "Jane", Initial = 'E', Last = null}}; + human.Mother = (mother); + + s.Save(human); + s.Save(mother); + s.Flush(); + + t.Commit(); + + t = s.BeginTransaction(); + var e = + Assert.Throws<QueryException>( + () => s.CreateQuery("update Human set mother.name.initial = :initial").SetString("initial", "F").ExecuteUpdate()); + Assert.That(e.Message, Text.StartsWith("Implied join paths are not assignable in update")); + + s.CreateQuery("delete Human where mother is not null").ExecuteUpdate(); + s.CreateQuery("delete Human").ExecuteUpdate(); + t.Commit(); + s.Close(); + } + #endregion #region DELETES @@ -228,18 +257,18 @@ // setup the test data... ISession s = OpenSession(); s.BeginTransaction(); - var owner = new SimpleEntityWithAssociation { Name = "myEntity-1" }; + var owner = new SimpleEntityWithAssociation {Name = "myEntity-1"}; owner.AddAssociation("assoc-1"); owner.AddAssociation("assoc-2"); owner.AddAssociation("assoc-3"); s.Save(owner); - var owner2 = new SimpleEntityWithAssociation { Name = "myEntity-2" }; + var owner2 = new SimpleEntityWithAssociation {Name = "myEntity-2"}; owner2.AddAssociation("assoc-1"); owner2.AddAssociation("assoc-2"); owner2.AddAssociation("assoc-3"); owner2.AddAssociation("assoc-4"); s.Save(owner2); - var owner3 = new SimpleEntityWithAssociation { Name = "myEntity-3" }; + var owner3 = new SimpleEntityWithAssociation {Name = "myEntity-3"}; s.Save(owner3); s.Transaction.Commit(); s.Close(); @@ -247,8 +276,9 @@ // now try the bulk delete s = OpenSession(); s.BeginTransaction(); - int count = s.CreateQuery("delete SimpleEntityWithAssociation e where size(e.AssociatedEntities ) = 0 and e.Name like '%'") - .ExecuteUpdate(); + int count = + s.CreateQuery("delete SimpleEntityWithAssociation e where size(e.AssociatedEntities ) = 0 and e.Name like '%'"). + ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "Incorrect delete count"); s.Transaction.Commit(); s.Close(); @@ -277,14 +307,11 @@ ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); - int count = s.CreateQuery("delete from Animal as a where a.id = :id") - .SetInt64("id", data.Polliwog.Id) - .ExecuteUpdate(); + int count = + s.CreateQuery("delete from Animal as a where a.id = :id").SetInt64("id", data.Polliwog.Id).ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "Incorrect delete count"); - count = s.CreateQuery("delete Animal where id = :id") - .SetInt64("id", data.Catepillar.Id) - .ExecuteUpdate(); + count = s.CreateQuery("delete Animal where id = :id").SetInt64("id", data.Catepillar.Id).ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "Incorrect delete count"); // HHH-873... @@ -359,8 +386,8 @@ ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); - int count = s.CreateQuery("delete Joiner where joinedName = :joinedName") - .SetString("joinedName", "joined-name").ExecuteUpdate(); + int count = + s.CreateQuery("delete Joiner where joinedName = :joinedName").SetString("joinedName", "joined-name").ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "Incorrect deletion count on joined class"); t.Commit(); @@ -379,8 +406,7 @@ ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); - int count = s.CreateQuery("delete Vehicle where Owner = :owner") - .SetString("owner", "Steve").ExecuteUpdate(); + int count = s.CreateQuery("delete Vehicle where Owner = :owner").SetString("owner", "Steve").ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "incorrect restricted update count"); count = s.CreateQuery("delete Vehicle").ExecuteUpdate(); @@ -402,9 +428,7 @@ ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); - int count = s.CreateQuery("delete Truck where Owner = :owner") - .SetString("owner", "Steve") - .ExecuteUpdate(); + int count = s.CreateQuery("delete Truck where Owner = :owner").SetString("owner", "Steve").ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "incorrect restricted update count"); count = s.CreateQuery("delete Truck").ExecuteUpdate(); @@ -425,9 +449,7 @@ ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); - int count = s.CreateQuery("delete Car where Owner = :owner") - .SetString("owner", "Kirsten") - .ExecuteUpdate(); + int count = s.CreateQuery("delete Car where Owner = :owner").SetString("owner", "Kirsten").ExecuteUpdate(); Assert.That(count, Is.EqualTo(1), "incorrect restricted update count"); count = s.CreateQuery("delete Car").ExecuteUpdate(); @@ -448,9 +470,7 @@ ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); - int count = s.CreateQuery("delete Animal where mother = :mother") - .SetEntity("mother", data.Butterfly) - .ExecuteUpdate(); + int count = s.CreateQuery("delete Animal where mother = :mother").SetEntity("mother", data.Butterfly).ExecuteUpdate(); Assert.That(count, Is.EqualTo(1)); t.Commit(); @@ -496,16 +516,16 @@ ISession s = tc.OpenNewSession(); ITransaction txn = s.BeginTransaction(); - Polliwog = new Animal { BodyWeight = 12, Description = "Polliwog" }; + Polliwog = new Animal {BodyWeight = 12, Description = "Polliwog"}; - Catepillar = new Animal { BodyWeight = 10, Description = "Catepillar" }; + Catepillar = new Animal {BodyWeight = 10, Description = "Catepillar"}; - Frog = new Animal { BodyWeight = 34, Description = "Frog" }; + Frog = new Animal {BodyWeight = 34, Description = "Frog"}; Polliwog.Father = Frog; Frog.AddOffspring(Polliwog); - Butterfly = new Animal { BodyWeight = 9, Description = "Butterfly" }; + Butterfly = new Animal {BodyWeight = 9, Description = "Butterfly"}; Catepillar.Mother = Butterfly; Butterfly.AddOffspring(Catepillar); @@ -515,36 +535,36 @@ s.Save(Butterfly); s.Save(Catepillar); - var dog = new Dog { BodyWeight = 200, Description = "dog" }; + var dog = new Dog {BodyWeight = 200, Description = "dog"}; s.Save(dog); - var cat = new Cat { BodyWeight = 100, Description = "cat" }; + var cat = new Cat {BodyWeight = 100, Description = "cat"}; s.Save(cat); - Zoo = new Zoo { Name = "Zoo" }; - var add = new Address { City = "MEL", Country = "AU", Street = "Main st", PostalCode = "3000" }; + Zoo = new Zoo {Name = "Zoo"}; + var add = new Address {City = "MEL", Country = "AU", Street = "Main st", PostalCode = "3000"}; Zoo.Address = add; - PettingZoo = new PettingZoo { Name = "Petting Zoo" }; - var addr = new Address { City = "Sydney", Country = "AU", Street = "High st", PostalCode = "2000" }; + PettingZoo = new PettingZoo {Name = "Petting Zoo"}; + var addr = new Address {City = "Sydney", Country = "AU", Street = "High st", PostalCode = "2000"}; PettingZoo.Address = addr; s.Save(Zoo); s.Save(PettingZoo); - var joiner = new Joiner { JoinedName = "joined-name", Name = "name" }; + var joiner = new Joiner {JoinedName = "joined-name", Name = "name"}; s.Save(joiner); - var car = new Car { Vin = "123c", Owner = "Kirsten" }; + var car = new Car {Vin = "123c", Owner = "Kirsten"}; s.Save(car); - var truck = new Truck { Vin = "123t", Owner = "Steve" }; + var truck = new Truck {Vin = "123t", Owner = "Steve"}; s.Save(truck); - var suv = new SUV { Vin = "123s", Owner = "Joe" }; + var suv = new SUV {Vin = "123s", Owner = "Joe"}; s.Save(suv); - var pickup = new Pickup { Vin = "123p", Owner = "Cecelia" }; + var pickup = new Pickup {Vin = "123p", Owner = "Cecelia"}; s.Save(pickup); var b = new BooleanLiteralEntity(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-06 14:22:17
|
Revision: 4250 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4250&view=rev Author: fabiomaulo Date: 2009-05-06 14:22:12 +0000 (Wed, 06 May 2009) Log Message: ----------- Continue port of AST tests for Updates (ManyToOne entity) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-06 06:12:21 UTC (rev 4249) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-06 14:22:12 UTC (rev 4250) @@ -2,6 +2,7 @@ using System.Collections; using System.Diagnostics; using System.Threading; +using NHibernate.Dialect; using NUnit.Framework; using NHibernate.Hql.Ast.ANTLR; @@ -200,6 +201,23 @@ s.Close(); } + [Test] + public void UpdateOnManyToOne() + { + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + s.CreateQuery("update Animal a set a.mother = null where a.id = 2").ExecuteUpdate(); + if (! (Dialect is MySQLDialect) ) + { + // MySQL does not support (even un-correlated) subqueries against the update-mutating table + s.CreateQuery("update Animal a set a.mother = (from Animal where id = 1) where a.id = 2").ExecuteUpdate(); + } + + t.Commit(); + s.Close(); + } + #endregion #region DELETES This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-06 06:12:23
|
Revision: 4249 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4249&view=rev Author: fabiomaulo Date: 2009-05-06 06:12:21 +0000 (Wed, 06 May 2009) Log Message: ----------- Continue port of AST tests for Updates (multitable entity) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableDeleteExecutor.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableDeleteExecutor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableDeleteExecutor.cs 2009-05-05 22:48:27 UTC (rev 4248) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableDeleteExecutor.cs 2009-05-06 06:12:21 UTC (rev 4249) @@ -82,20 +82,19 @@ { try { - var parameterTypes = new List<SqlType>(Walker.Parameters.Count); - foreach (var parameterSpecification in Walker.Parameters) + var paramsSpec = Walker.Parameters; + var parameterTypes = new List<SqlType>(paramsSpec.Count); + foreach (var parameterSpecification in paramsSpec) { parameterTypes.AddRange(parameterSpecification.ExpectedType.SqlTypes(Factory)); } ps = session.Batcher.PrepareCommand(CommandType.Text, idInsertSelect, parameterTypes.ToArray()); - IEnumerator<IParameterSpecification> paramSpecifications = Walker.Parameters.GetEnumerator(); // NH Different behavior: The inital value is 0 (initialized to 1 in JAVA) int pos = 0; - while (paramSpecifications.MoveNext()) + foreach (var specification in paramsSpec) { - var paramSpec = paramSpecifications.Current; - pos += paramSpec.Bind(ps, parameters, session, pos); + pos += specification.Bind(ps, parameters, session, pos); } resultCount = session.Batcher.ExecuteNonQuery(ps); } Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs 2009-05-05 22:48:27 UTC (rev 4248) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs 2009-05-06 06:12:21 UTC (rev 4249) @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Data; +using System.Data.Common; using log4net; using NHibernate.Engine; using NHibernate.Exceptions; @@ -16,7 +17,7 @@ [CLSCompliant(false)] public class MultiTableUpdateExecutor : AbstractStatementExecutor { - private static readonly ILog log = LogManager.GetLogger(typeof(MultiTableDeleteExecutor)); + private static readonly ILog log = LogManager.GetLogger(typeof (MultiTableDeleteExecutor)); private readonly IQueryable persister; private readonly SqlString idInsertSelect; private readonly SqlString[] updates; @@ -28,7 +29,7 @@ { throw new HibernateException("cannot perform multi-table updates using dialect not supporting temp tables"); } - var updateStatement = (UpdateStatement)statement; + var updateStatement = (UpdateStatement) statement; FromElement fromElement = updateStatement.FromClause.GetFromElement(); string bulkTargetAlias = fromElement.TableAlias; @@ -41,7 +42,7 @@ string[][] columnNames = persister.ContraintOrderedTableKeyColumnClosure; string idSubselect = GenerateIdSubselect(persister); - var assignmentSpecifications = Walker.AssignmentSpecifications; + IList<AssignmentSpecification> assignmentSpecifications = Walker.AssignmentSpecifications; updates = new SqlString[tableNames.Length]; hqlParameters = new IParameterSpecification[tableNames.Length][]; @@ -49,9 +50,10 @@ { bool affected = false; var parameterList = new List<IParameterSpecification>(); - SqlUpdateBuilder update = new SqlUpdateBuilder(Factory.Dialect, Factory) - .SetTableName(tableNames[tableIndex]) - .SetWhere("(" + StringHelper.Join(", ", columnNames[tableIndex]) + ") IN (" + idSubselect + ")"); + SqlUpdateBuilder update = + new SqlUpdateBuilder(Factory.Dialect, Factory).SetTableName(tableNames[tableIndex]) + .SetWhere( + string.Format("({0}) IN ({1})", StringHelper.Join(", ", columnNames[tableIndex]), idSubselect)); if (Factory.Settings.IsCommentsEnabled) { @@ -100,28 +102,16 @@ { try { - var parameterTypes = new List<SqlType>(Walker.Parameters.Count); - foreach (var parameterSpecification in Walker.Parameters) - { - parameterTypes.AddRange(parameterSpecification.ExpectedType.SqlTypes(Factory)); - } + int parameterStart = Walker.NumberOfParametersInSetClause; - ps = session.Batcher.PrepareCommand(CommandType.Text, idInsertSelect, parameterTypes.ToArray()); + IList<IParameterSpecification> allParams = Walker.Parameters; - int parameterStart = Walker.NumberOfParametersInSetClause; + List<IParameterSpecification> whereParams = (new List<IParameterSpecification>(allParams)).GetRange( + parameterStart, allParams.Count - parameterStart); - var allParams = Walker.Parameters; + ps = session.Batcher.PrepareCommand(CommandType.Text, idInsertSelect, GetParametersTypes(whereParams)); - IEnumerator<IParameterSpecification> whereParams = - (new List<IParameterSpecification>(allParams)).GetRange(parameterStart, allParams.Count - parameterStart). - GetEnumerator(); - // NH Different behavior: The inital value is 0 (initialized to 1 in JAVA) - int pos = 0; - while (whereParams.MoveNext()) - { - var paramSpec = whereParams.Current; - pos += paramSpec.Bind(ps, parameters, session, pos); - } + BindParameters(whereParams, ps, parameters, session); resultCount = session.Batcher.ExecuteNonQuery(ps); } finally @@ -132,9 +122,10 @@ } } } - catch (System.Data.OleDb.OleDbException e) + catch (DbException e) { - throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, e, "could not insert/select ids for bulk update", idInsertSelect); + throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, e, "could not insert/select ids for bulk update", + idInsertSelect); } // Start performing the updates @@ -148,16 +139,8 @@ { try { - ps = session.Batcher.PrepareCommand(CommandType.Text, updates[i], new SqlType[0]); - - if (hqlParameters[i] != null) - { - int position = 1; // ADO params are 0-based - for (int x = 0; x < hqlParameters[i].Length; x++) - { - position += hqlParameters[i][x].Bind(ps, parameters, session, position); - } - } + ps = session.Batcher.PrepareCommand(CommandType.Text, updates[i], GetParametersTypes(hqlParameters[i])); + BindParameters(hqlParameters[i], ps, parameters, session); session.Batcher.ExecuteNonQuery(ps); } finally @@ -168,7 +151,7 @@ } } } - catch (System.Data.OleDb.OleDbException e) + catch (DbException e) { throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, e, "error performing bulk update", updates[i]); } @@ -182,9 +165,37 @@ } } + private SqlType[] GetParametersTypes(IEnumerable<IParameterSpecification> specifications) + { + if (specifications == null) + { + return new SqlType[0]; + } + var result = new List<SqlType>(); + foreach (var specification in specifications) + { + result.AddRange(specification.ExpectedType.SqlTypes(Factory)); + } + return result.ToArray(); + } + + private static void BindParameters(IEnumerable<IParameterSpecification> specifications, IDbCommand command, + QueryParameters parameters, ISessionImplementor session) + { + if (specifications == null) + { + return; + } + int position = 0; // ADO params are 0-based + foreach (var specification in specifications) + { + position += specification.Bind(command, parameters, session, position); + } + } + protected override IQueryable[] AffectedQueryables { - get { return new[] { persister }; } + get { return new[] {persister}; } } } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-05 22:48:27 UTC (rev 4248) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-06 06:12:21 UTC (rev 4249) @@ -166,8 +166,40 @@ s.Delete(entity); t.Commit(); s.Close(); - } - + } + + [Test] + public void UpdateOnComponent() + { + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + var human = new Human {Name = new Name {First = "Stevee", Initial = 'X', Last = "Ebersole"}}; + + s.Save(human); + t.Commit(); + + string correctName = "Steve"; + + t = s.BeginTransaction(); + int count = + s.CreateQuery("update Human set name.first = :correction where id = :id") + .SetString("correction", correctName) + .SetInt64("id", human.Id).ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "incorrect update count"); + t.Commit(); + + t = s.BeginTransaction(); + s.Refresh(human); + + Assert.That(human.Name.First, Is.EqualTo(correctName), "Update did not execute properly"); + + s.CreateQuery("delete Human").ExecuteUpdate(); + t.Commit(); + + s.Close(); + } + #endregion #region DELETES This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-05 22:48:32
|
Revision: 4248 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4248&view=rev Author: fabiomaulo Date: 2009-05-05 22:48:27 +0000 (Tue, 05 May 2009) Log Message: ----------- Continue port of AST tests for Updates (versioned entity) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-05 22:37:54 UTC (rev 4247) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-05 22:48:27 UTC (rev 4248) @@ -1,5 +1,7 @@ +using System; using System.Collections; using System.Diagnostics; +using System.Threading; using NUnit.Framework; using NHibernate.Hql.Ast.ANTLR; @@ -136,6 +138,36 @@ s.Close(); } + [Test] + public void IncrementTimestampVersion() + { + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + var entity = new TimestampVersioned {Name = "ts-vers"}; + s.Save(entity); + t.Commit(); + s.Close(); + + DateTime initialVersion = entity.Version; + + Thread.Sleep(300); + + s = OpenSession(); + t = s.BeginTransaction(); + int count = s.CreateQuery("update versioned TimestampVersioned set name = name").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "incorrect exec count"); + t.Commit(); + + t = s.BeginTransaction(); + entity = s.Load<TimestampVersioned>(entity.Id); + Assert.That(entity.Version, Is.GreaterThan(initialVersion), "version not incremented"); + + s.Delete(entity); + t.Commit(); + s.Close(); + } + #endregion #region DELETES This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-05 22:37:56
|
Revision: 4247 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4247&view=rev Author: fabiomaulo Date: 2009-05-05 22:37:54 +0000 (Tue, 05 May 2009) Log Message: ----------- Continue port of AST tests for Updates (versioned entity) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlLexer.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlParser.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlSqlWalker.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/SqlGenerator.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/ASTNode.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlLexer.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlLexer.cs 2009-05-05 18:07:06 UTC (rev 4246) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Generated/HqlLexer.cs 2009-05-05 22:37:54 UTC (rev 4247) @@ -1,4586 +1,4587 @@ -// $ANTLR 3.1.2 /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g 2009-04-23 21:03:14 - -// The variable 'variable' is assigned but its value is never used. -#pragma warning disable 168, 219 -// Unreachable code detected. -#pragma warning disable 162 -namespace NHibernate.Hql.Ast.ANTLR -{ - -using System; -using Antlr.Runtime; -using IList = System.Collections.IList; -using ArrayList = System.Collections.ArrayList; -using Stack = Antlr.Runtime.Collections.StackList; - -using IDictionary = System.Collections.IDictionary; -using Hashtable = System.Collections.Hashtable; - -public partial class HqlLexer : Lexer { - public const int EXPR_LIST = 73; - public const int EXISTS = 19; - public const int COMMA = 98; - public const int FETCH = 21; - public const int MINUS = 110; - public const int AS = 7; - public const int END = 56; - public const int INTO = 30; - public const int FALSE = 20; - public const int ELEMENTS = 17; - public const int THEN = 58; - public const int ALIAS = 70; - public const int ON = 60; - public const int DOT = 15; - public const int ORDER = 41; - public const int AND = 6; - public const int CONSTANT = 92; - public const int UNARY_MINUS = 88; - public const int METHOD_CALL = 79; - public const int RIGHT = 44; - public const int CONCAT = 108; - public const int PROPERTIES = 43; - public const int SELECT = 45; - public const int LE = 106; - public const int BETWEEN = 10; - public const int NUM_INT = 93; - public const int BOTH = 62; - public const int PLUS = 109; - public const int VERSIONED = 52; - public const int MEMBER = 65; - public const int UNION = 50; - public const int DISTINCT = 16; - public const int RANGE = 85; - public const int FILTER_ENTITY = 74; - public const int IDENT = 118; - public const int WHEN = 59; - public const int DESCENDING = 14; - public const int WS = 122; - public const int NEW = 37; - public const int EQ = 99; - public const int LT = 104; - public const int ESCqs = 121; - public const int OF = 67; - public const int UPDATE = 51; - public const int SELECT_FROM = 87; - public const int LITERAL_by = 54; - public const int FLOAT_SUFFIX = 124; - public const int ANY = 5; - public const int UNARY_PLUS = 89; - public const int NUM_FLOAT = 95; - public const int GE = 107; - public const int CASE = 55; - public const int OPEN_BRACKET = 113; - public const int ELSE = 57; - public const int OPEN = 100; - public const int COUNT = 12; - public const int NULL = 39; - public const int COLON = 115; - public const int DIV = 112; - public const int HAVING = 25; - public const int ALL = 4; - public const int SET = 46; - public const int INSERT = 29; - public const int TRUE = 49; - public const int CASE2 = 72; - public const int IS_NOT_NULL = 77; - public const int WHERE = 53; - public const int AGGREGATE = 69; - public const int VECTOR_EXPR = 90; - public const int LEADING = 64; - public const int CLOSE_BRACKET = 114; - public const int NUM_DOUBLE = 94; - public const int T__126 = 126; - public const int INNER = 28; - public const int QUERY = 84; - public const int ORDER_ELEMENT = 83; - public const int OR = 40; - public const int FULL = 23; - public const int INDICES = 27; - public const int IS_NULL = 78; - public const int GROUP = 24; - public const int ESCAPE = 18; - public const int T__127 = 127; - public const int PARAM = 116; - public const int ID_LETTER = 120; - public const int INDEX_OP = 76; - public const int HEX_DIGIT = 125; - public const int LEFT = 33; - public const int TRAILING = 68; - public const int JOIN = 32; - public const int NOT_BETWEEN = 80; - public const int SUM = 48; - public const int ROW_STAR = 86; - public const int OUTER = 42; - public const int NOT_IN = 81; - public const int FROM = 22; - public const int DELETE = 13; - public const int OBJECT = 66; - public const int MAX = 35; - public const int NOT_LIKE = 82; - public const int EMPTY = 63; - public const int QUOTED_String = 117; - public const int ASCENDING = 8; - public const int NUM_LONG = 96; - public const int IS = 31; - public const int SQL_NE = 103; - public const int IN_LIST = 75; - public const int WEIRD_IDENT = 91; - public const int NE = 102; - public const int GT = 105; - public const int MIN = 36; - public const int LIKE = 34; - public const int WITH = 61; - public const int IN = 26; - public const int CONSTRUCTOR = 71; - public const int SOME = 47; - public const int CLASS = 11; - public const int EXPONENT = 123; - public const int ID_START_LETTER = 119; - public const int EOF = -1; - public const int CLOSE = 101; - public const int AVG = 9; - public const int STAR = 111; - public const int NOT = 38; - public const int JAVA_CONSTANT = 97; - - // delegates - // delegators - - public HqlLexer() - { - InitializeCyclicDFAs(); - } - public HqlLexer(ICharStream input) - : this(input, null) { - } - public HqlLexer(ICharStream input, RecognizerSharedState state) - : base(input, state) { - InitializeCyclicDFAs(); - - } - - override public string GrammarFileName - { - get { return "/Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g";} - } - - // $ANTLR start "ALL" - public void mALL() // throws RecognitionException [2] - { - try - { - int _type = ALL; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:9:5: ( 'all' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:9:7: 'all' - { - Match("all"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "ALL" - - // $ANTLR start "ANY" - public void mANY() // throws RecognitionException [2] - { - try - { - int _type = ANY; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:10:5: ( 'any' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:10:7: 'any' - { - Match("any"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "ANY" - - // $ANTLR start "AND" - public void mAND() // throws RecognitionException [2] - { - try - { - int _type = AND; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:11:5: ( 'and' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:11:7: 'and' - { - Match("and"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "AND" - - // $ANTLR start "AS" - public void mAS() // throws RecognitionException [2] - { - try - { - int _type = AS; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:12:4: ( 'as' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:12:6: 'as' - { - Match("as"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "AS" - - // $ANTLR start "ASCENDING" - public void mASCENDING() // throws RecognitionException [2] - { - try - { - int _type = ASCENDING; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:13:11: ( 'asc' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:13:13: 'asc' - { - Match("asc"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "ASCENDING" - - // $ANTLR start "AVG" - public void mAVG() // throws RecognitionException [2] - { - try - { - int _type = AVG; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:14:5: ( 'avg' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:14:7: 'avg' - { - Match("avg"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "AVG" - - // $ANTLR start "BETWEEN" - public void mBETWEEN() // throws RecognitionException [2] - { - try - { - int _type = BETWEEN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:15:9: ( 'between' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:15:11: 'between' - { - Match("between"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "BETWEEN" - - // $ANTLR start "CLASS" - public void mCLASS() // throws RecognitionException [2] - { - try - { - int _type = CLASS; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:16:7: ( 'class' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:16:9: 'class' - { - Match("class"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "CLASS" - - // $ANTLR start "COUNT" - public void mCOUNT() // throws RecognitionException [2] - { - try - { - int _type = COUNT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:17:7: ( 'count' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:17:9: 'count' - { - Match("count"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "COUNT" - - // $ANTLR start "DELETE" - public void mDELETE() // throws RecognitionException [2] - { - try - { - int _type = DELETE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:18:8: ( 'delete' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:18:10: 'delete' - { - Match("delete"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "DELETE" - - // $ANTLR start "DESCENDING" - public void mDESCENDING() // throws RecognitionException [2] - { - try - { - int _type = DESCENDING; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:19:12: ( 'desc' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:19:14: 'desc' - { - Match("desc"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "DESCENDING" - - // $ANTLR start "DISTINCT" - public void mDISTINCT() // throws RecognitionException [2] - { - try - { - int _type = DISTINCT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:20:10: ( 'distinct' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:20:12: 'distinct' - { - Match("distinct"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "DISTINCT" - - // $ANTLR start "ELEMENTS" - public void mELEMENTS() // throws RecognitionException [2] - { - try - { - int _type = ELEMENTS; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:21:10: ( 'elements' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:21:12: 'elements' - { - Match("elements"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "ELEMENTS" - - // $ANTLR start "ESCAPE" - public void mESCAPE() // throws RecognitionException [2] - { - try - { - int _type = ESCAPE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:22:8: ( 'escape' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:22:10: 'escape' - { - Match("escape"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "ESCAPE" - - // $ANTLR start "EXISTS" - public void mEXISTS() // throws RecognitionException [2] - { - try - { - int _type = EXISTS; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:23:8: ( 'exists' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:23:10: 'exists' - { - Match("exists"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "EXISTS" - - // $ANTLR start "FALSE" - public void mFALSE() // throws RecognitionException [2] - { - try - { - int _type = FALSE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:24:7: ( 'false' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:24:9: 'false' - { - Match("false"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "FALSE" - - // $ANTLR start "FETCH" - public void mFETCH() // throws RecognitionException [2] - { - try - { - int _type = FETCH; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:25:7: ( 'fetch' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:25:9: 'fetch' - { - Match("fetch"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "FETCH" - - // $ANTLR start "FROM" - public void mFROM() // throws RecognitionException [2] - { - try - { - int _type = FROM; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:26:6: ( 'from' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:26:8: 'from' - { - Match("from"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "FROM" - - // $ANTLR start "FULL" - public void mFULL() // throws RecognitionException [2] - { - try - { - int _type = FULL; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:27:6: ( 'full' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:27:8: 'full' - { - Match("full"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "FULL" - - // $ANTLR start "GROUP" - public void mGROUP() // throws RecognitionException [2] - { - try - { - int _type = GROUP; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:28:7: ( 'group' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:28:9: 'group' - { - Match("group"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "GROUP" - - // $ANTLR start "HAVING" - public void mHAVING() // throws RecognitionException [2] - { - try - { - int _type = HAVING; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:29:8: ( 'having' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:29:10: 'having' - { - Match("having"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "HAVING" - - // $ANTLR start "IN" - public void mIN() // throws RecognitionException [2] - { - try - { - int _type = IN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:30:4: ( 'in' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:30:6: 'in' - { - Match("in"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "IN" - - // $ANTLR start "INDICES" - public void mINDICES() // throws RecognitionException [2] - { - try - { - int _type = INDICES; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:31:9: ( 'indices' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:31:11: 'indices' - { - Match("indices"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "INDICES" - - // $ANTLR start "INNER" - public void mINNER() // throws RecognitionException [2] - { - try - { - int _type = INNER; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:32:7: ( 'inner' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:32:9: 'inner' - { - Match("inner"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "INNER" - - // $ANTLR start "INSERT" - public void mINSERT() // throws RecognitionException [2] - { - try - { - int _type = INSERT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:33:8: ( 'insert' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:33:10: 'insert' - { - Match("insert"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "INSERT" - - // $ANTLR start "INTO" - public void mINTO() // throws RecognitionException [2] - { - try - { - int _type = INTO; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:34:6: ( 'into' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:34:8: 'into' - { - Match("into"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "INTO" - - // $ANTLR start "IS" - public void mIS() // throws RecognitionException [2] - { - try - { - int _type = IS; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:35:4: ( 'is' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:35:6: 'is' - { - Match("is"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "IS" - - // $ANTLR start "JOIN" - public void mJOIN() // throws RecognitionException [2] - { - try - { - int _type = JOIN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:36:6: ( 'join' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:36:8: 'join' - { - Match("join"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "JOIN" - - // $ANTLR start "LEFT" - public void mLEFT() // throws RecognitionException [2] - { - try - { - int _type = LEFT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:37:6: ( 'left' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:37:8: 'left' - { - Match("left"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "LEFT" - - // $ANTLR start "LIKE" - public void mLIKE() // throws RecognitionException [2] - { - try - { - int _type = LIKE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:38:6: ( 'like' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:38:8: 'like' - { - Match("like"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "LIKE" - - // $ANTLR start "MAX" - public void mMAX() // throws RecognitionException [2] - { - try - { - int _type = MAX; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:39:5: ( 'max' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:39:7: 'max' - { - Match("max"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "MAX" - - // $ANTLR start "MIN" - public void mMIN() // throws RecognitionException [2] - { - try - { - int _type = MIN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:40:5: ( 'min' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:40:7: 'min' - { - Match("min"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "MIN" - - // $ANTLR start "NEW" - public void mNEW() // throws RecognitionException [2] - { - try - { - int _type = NEW; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:41:5: ( 'new' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:41:7: 'new' - { - Match("new"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "NEW" - - // $ANTLR start "NOT" - public void mNOT() // throws RecognitionException [2] - { - try - { - int _type = NOT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:42:5: ( 'not' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:42:7: 'not' - { - Match("not"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "NOT" - - // $ANTLR start "NULL" - public void mNULL() // throws RecognitionException [2] - { - try - { - int _type = NULL; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:43:6: ( 'null' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:43:8: 'null' - { - Match("null"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "NULL" - - // $ANTLR start "OR" - public void mOR() // throws RecognitionException [2] - { - try - { - int _type = OR; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:44:4: ( 'or' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:44:6: 'or' - { - Match("or"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "OR" - - // $ANTLR start "ORDER" - public void mORDER() // throws RecognitionException [2] - { - try - { - int _type = ORDER; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:45:7: ( 'order' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:45:9: 'order' - { - Match("order"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "ORDER" - - // $ANTLR start "OUTER" - public void mOUTER() // throws RecognitionException [2] - { - try - { - int _type = OUTER; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:46:7: ( 'outer' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:46:9: 'outer' - { - Match("outer"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "OUTER" - - // $ANTLR start "PROPERTIES" - public void mPROPERTIES() // throws RecognitionException [2] - { - try - { - int _type = PROPERTIES; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:47:12: ( 'properties' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:47:14: 'properties' - { - Match("properties"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "PROPERTIES" - - // $ANTLR start "RIGHT" - public void mRIGHT() // throws RecognitionException [2] - { - try - { - int _type = RIGHT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:48:7: ( 'right' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:48:9: 'right' - { - Match("right"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "RIGHT" - - // $ANTLR start "SELECT" - public void mSELECT() // throws RecognitionException [2] - { - try - { - int _type = SELECT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:49:8: ( 'select' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:49:10: 'select' - { - Match("select"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "SELECT" - - // $ANTLR start "SET" - public void mSET() // throws RecognitionException [2] - { - try - { - int _type = SET; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:50:5: ( 'set' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:50:7: 'set' - { - Match("set"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "SET" - - // $ANTLR start "SOME" - public void mSOME() // throws RecognitionException [2] - { - try - { - int _type = SOME; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:51:6: ( 'some' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:51:8: 'some' - { - Match("some"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "SOME" - - // $ANTLR start "SUM" - public void mSUM() // throws RecognitionException [2] - { - try - { - int _type = SUM; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:52:5: ( 'sum' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:52:7: 'sum' - { - Match("sum"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "SUM" - - // $ANTLR start "TRUE" - public void mTRUE() // throws RecognitionException [2] - { - try - { - int _type = TRUE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:53:6: ( 'true' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:53:8: 'true' - { - Match("true"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "TRUE" - - // $ANTLR start "UNION" - public void mUNION() // throws RecognitionException [2] - { - try - { - int _type = UNION; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:54:7: ( 'union' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:54:9: 'union' - { - Match("union"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "UNION" - - // $ANTLR start "UPDATE" - public void mUPDATE() // throws RecognitionException [2] - { - try - { - int _type = UPDATE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:55:8: ( 'update' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:55:10: 'update' - { - Match("update"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "UPDATE" - - // $ANTLR start "VERSIONED" - public void mVERSIONED() // throws RecognitionException [2] - { - try - { - int _type = VERSIONED; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:56:11: ( 'versioned' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:56:13: 'versioned' - { - Match("versioned"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "VERSIONED" - - // $ANTLR start "WHERE" - public void mWHERE() // throws RecognitionException [2] - { - try - { - int _type = WHERE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:57:7: ( 'where' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:57:9: 'where' - { - Match("where"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "WHERE" - - // $ANTLR start "LITERAL_by" - public void mLITERAL_by() // throws RecognitionException [2] - { - try - { - int _type = LITERAL_by; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:58:12: ( 'by' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:58:14: 'by' - { - Match("by"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "LITERAL_by" - - // $ANTLR start "CASE" - public void mCASE() // throws RecognitionException [2] - { - try - { - int _type = CASE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:59:6: ( 'case' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:59:8: 'case' - { - Match("case"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "CASE" - - // $ANTLR start "END" - public void mEND() // throws RecognitionException [2] - { - try - { - int _type = END; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:60:5: ( 'end' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:60:7: 'end' - { - Match("end"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "END" - - // $ANTLR start "ELSE" - public void mELSE() // throws RecognitionException [2] - { - try - { - int _type = ELSE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:61:6: ( 'else' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:61:8: 'else' - { - Match("else"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "ELSE" - - // $ANTLR start "THEN" - public void mTHEN() // throws RecognitionException [2] - { - try - { - int _type = THEN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:62:6: ( 'then' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:62:8: 'then' - { - Match("then"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "THEN" - - // $ANTLR start "WHEN" - public void mWHEN() // throws RecognitionException [2] - { - try - { - int _type = WHEN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:63:6: ( 'when' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:63:8: 'when' - { - Match("when"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "WHEN" - - // $ANTLR start "ON" - public void mON() // throws RecognitionException [2] - { - try - { - int _type = ON; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:64:4: ( 'on' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:64:6: 'on' - { - Match("on"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "ON" - - // $ANTLR start "WITH" - public void mWITH() // throws RecognitionException [2] - { - try - { - int _type = WITH; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:65:6: ( 'with' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:65:8: 'with' - { - Match("with"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "WITH" - - // $ANTLR start "BOTH" - public void mBOTH() // throws RecognitionException [2] - { - try - { - int _type = BOTH; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:66:6: ( 'both' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:66:8: 'both' - { - Match("both"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "BOTH" - - // $ANTLR start "EMPTY" - public void mEMPTY() // throws RecognitionException [2] - { - try - { - int _type = EMPTY; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:67:7: ( 'empty' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:67:9: 'empty' - { - Match("empty"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "EMPTY" - - // $ANTLR start "LEADING" - public void mLEADING() // throws RecognitionException [2] - { - try - { - int _type = LEADING; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:68:9: ( 'leading' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:68:11: 'leading' - { - Match("leading"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "LEADING" - - // $ANTLR start "MEMBER" - public void mMEMBER() // throws RecognitionException [2] - { - try - { - int _type = MEMBER; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:69:8: ( 'member' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:69:10: 'member' - { - Match("member"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "MEMBER" - - // $ANTLR start "OBJECT" - public void mOBJECT() // throws RecognitionException [2] - { - try - { - int _type = OBJECT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:70:8: ( 'object' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:70:10: 'object' - { - Match("object"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "OBJECT" - - // $ANTLR start "OF" - public void mOF() // throws RecognitionException [2] - { - try - { - int _type = OF; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:71:4: ( 'of' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:71:6: 'of' - { - Match("of"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "OF" - - // $ANTLR start "TRAILING" - public void mTRAILING() // throws RecognitionException [2] - { - try - { - int _type = TRAILING; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:72:10: ( 'trailing' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:72:12: 'trailing' - { - Match("trailing"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "TRAILING" - - // $ANTLR start "T__126" - public void mT__126() // throws RecognitionException [2] - { - try - { - int _type = T__126; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:73:8: ( 'ascending' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:73:10: 'ascending' - { - Match("ascending"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "T__126" - - // $ANTLR start "T__127" - public void mT__127() // throws RecognitionException [2] - { - try - { - int _type = T__127; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:74:8: ( 'descending' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:74:10: 'descending' - { - Match("descending"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "T__127" - - // $ANTLR start "EQ" - public void mEQ() // throws RecognitionException [2] - { - try - { - int _type = EQ; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:741:3: ( '=' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:741:5: '=' - { - Match('='); if (state.failed) return ; - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "EQ" - - // $ANTLR start "LT" - public void mLT() // throws RecognitionException [2] - { - try - { - int _type = LT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:742:3: ( '<' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:742:5: '<' - { - Match('<'); if (state.failed) return ; - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "LT" - - // $ANTLR start "GT" - public void mGT() // throws RecognitionException [2] - { - try - { - int _type = GT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:743:3: ( '>' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:743:5: '>' - { - Match('>'); if (state.failed) return ; - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "GT" - - // $ANTLR start "SQL_NE" - public void mSQL_NE() // throws RecognitionException [2] - { - try - { - int _type = SQL_NE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:744:7: ( '<>' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:744:9: '<>' - { - Match("<>"); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "SQL_NE" - - // $ANTLR start "NE" - public void mNE() // throws RecognitionException [2] - { - try - { - int _type = NE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:745:3: ( '!=' | '^=' ) - int alt1 = 2; - int LA1_0 = input.LA(1); - - if ( (LA1_0 == '!') ) - { - alt1 = 1; - } - else if ( (LA1_0 == '^') ) - { - alt1 = 2; - } - else - { - if ( state.backtracking > 0 ) {state.failed = true; return ;} - NoViableAltException nvae_d1s0 = - new NoViableAltException("", 1, 0, input); - - throw nvae_d1s0; - } - switch (alt1) - { - case 1 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:745:5: '!=' - { - Match("!="); if (state.failed) return ; - - - } - break; - case 2 : - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:745:12: '^=' - { - Match("^="); if (state.failed) return ; - - - } - break; - - } - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "NE" - - // $ANTLR start "LE" - public void mLE() // throws RecognitionException [2] - { - try - { - int _type = LE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:746:3: ( '<=' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:746:5: '<=' - { - Match("<="); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "LE" - - // $ANTLR start "GE" - public void mGE() // throws RecognitionException [2] - { - try - { - int _type = GE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:747:3: ( '>=' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:747:5: '>=' - { - Match(">="); if (state.failed) return ; - - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "GE" - - // $ANTLR start "COMMA" - public void mCOMMA() // throws RecognitionException [2] - { - try - { - int _type = COMMA; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:749:6: ( ',' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:749:8: ',' - { - Match(','); if (state.failed) return ; - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "COMMA" - - // $ANTLR start "OPEN" - public void mOPEN() // throws RecognitionException [2] - { - try - { - int _type = OPEN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:751:5: ( '(' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:751:7: '(' - { - Match('('); if (state.failed) return ; - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "OPEN" - - // $ANTLR start "CLOSE" - public void mCLOSE() // throws RecognitionException [2] - { - try - { - int _type = CLOSE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:752:6: ( ')' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:752:8: ')' - { - Match(')'); if (state.failed) return ; - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "CLOSE" - - // $ANTLR start "OPEN_BRACKET" - public void mOPEN_BRACKET() // throws RecognitionException [2] - { - try - { - int _type = OPEN_BRACKET; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:753:13: ( '[' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:753:15: '[' - { - Match('['); if (state.failed) return ; - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "OPEN_BRACKET" - - // $ANTLR start "CLOSE_BRACKET" - public void mCLOSE_BRACKET() // throws RecognitionException [2] - { - try - { - int _type = CLOSE_BRACKET; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:754:14: ( ']' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:754:16: ']' - { - Match(']'); if (state.failed) return ; - - } - - state.type = _type; - state.channel = _channel; - } - finally - { - } - } - // $ANTLR end "CLOSE_BRACKET" - - // $ANTLR start "CONCAT" - public void mCONCAT() // throws RecognitionException [2] - { - try - { - int _type = CONCAT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:756:7: ( '||' ) - // /Users/Steve/Projects/NHibernate/Trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:756:9: '||' - { - Match("||"); if (state.failed) r... [truncated message content] |
From: <fab...@us...> - 2009-05-05 18:07:11
|
Revision: 4246 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4246&view=rev Author: fabiomaulo Date: 2009-05-05 18:07:06 +0000 (Tue, 05 May 2009) Log Message: ----------- Continue port of AST tests for Updates Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/ASTNode.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/IASTNode.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Added Paths: ----------- trunk/nhibernate/src/NHibernate/Param/VersionTypeSeedParameterSpecification.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs 2009-05-05 15:38:45 UTC (rev 4245) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs 2009-05-05 18:07:06 UTC (rev 4246) @@ -22,7 +22,7 @@ private readonly SqlString[] updates; private readonly IParameterSpecification[][] hqlParameters; - public MultiTableUpdateExecutor(IStatement statement, ILog log) : base(statement, log) + public MultiTableUpdateExecutor(IStatement statement) : base(statement, log) { if (!Factory.Dialect.SupportsTemporaryTables) { Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs 2009-05-05 15:38:45 UTC (rev 4245) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs 2009-05-05 18:07:06 UTC (rev 4246) @@ -11,6 +11,7 @@ using NHibernate.Persister.Entity; using NHibernate.SqlCommand; using NHibernate.Type; +using NHibernate.UserTypes; using NHibernate.Util; namespace NHibernate.Hql.Ast.ANTLR @@ -167,12 +168,69 @@ void PrepareVersioned(IASTNode updateNode, IASTNode versioned) { - throw new NotImplementedException(); // DML + var updateStatement = (UpdateStatement)updateNode; + FromClause fromClause = updateStatement.FromClause; + if (versioned != null) + { + // Make sure that the persister is versioned + IQueryable persister = fromClause.GetFromElement().Queryable; + if (!persister.IsVersioned) + { + throw new SemanticException("increment option specified for update of non-versioned entity"); + } + + IVersionType versionType = persister.VersionType; + if (versionType is IUserVersionType) + { + throw new SemanticException("user-defined version types not supported for increment option"); + } + + IASTNode eq = ASTFactory.CreateNode(EQ, "="); + IASTNode versionPropertyNode = GenerateVersionPropertyNode(persister); + + eq.SetFirstChild(versionPropertyNode); + + IASTNode versionIncrementNode; + if (typeof(DateTime).IsAssignableFrom(versionType.ReturnedClass)) + { + versionIncrementNode = ASTFactory.CreateNode(PARAM, "?"); + IParameterSpecification paramSpec = new VersionTypeSeedParameterSpecification(versionType); + ((ParameterNode)versionIncrementNode).HqlParameterSpecification = paramSpec; + Parameters.Insert(0, paramSpec); + } + else + { + // Not possible to simply re-use the versionPropertyNode here as it causes + // OOM errors due to circularity :( + versionIncrementNode = ASTFactory.CreateNode(PLUS, "+"); + versionIncrementNode.SetFirstChild(GenerateVersionPropertyNode(persister)); + versionIncrementNode.AddChild(ASTFactory.CreateNode(IDENT, "1")); + } + + eq.AddChild(versionIncrementNode); + + EvaluateAssignment(eq, persister, 0); + + IASTNode setClause = updateStatement.SetClause; + IASTNode currentFirstSetElement = setClause.GetFirstChild(); + setClause.SetFirstChild(eq); + eq.NextSibling= currentFirstSetElement; + } } + private IASTNode GenerateVersionPropertyNode(IQueryable persister) + { + string versionPropertyName = persister.PropertyNames[persister.VersionProperty]; + var versionPropertyRef = ASTFactory.CreateNode(IDENT, versionPropertyName); + var versionPropertyNode = LookupNonQualifiedProperty(versionPropertyRef); + Resolve(versionPropertyNode); + return versionPropertyNode; + } + void PostProcessUpdate(IASTNode update) { - throw new NotImplementedException(); // DML + var updateStatement = (UpdateStatement)update; + PostProcessDML(updateStatement); } void PostProcessDelete(IASTNode delete) Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs 2009-05-05 15:38:45 UTC (rev 4245) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/QueryTranslatorImpl.cs 2009-05-05 18:07:06 UTC (rev 4246) @@ -242,10 +242,12 @@ var list = new List<string>(); if (IsManipulationStatement) { - SqlString[] sqlStatements = statementExecutor.SqlStatements; - foreach (var sqlStatement in sqlStatements) + foreach (var sqlStatement in statementExecutor.SqlStatements) { - list.Add(sqlStatement.ToString()); + if (sqlStatement != null) + { + list.Add(sqlStatement.ToString()); + } } } else @@ -419,7 +421,7 @@ // even here, if only properties mapped to the "base table" are referenced // in the set and where clauses, this could be handled by the BasicDelegate. // TODO : decide if it is better performance-wise to perform that check, or to simply use the MultiTableUpdateDelegate - return new MultiTableDeleteExecutor(statement); + return new MultiTableUpdateExecutor(statement); } else { Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/ASTNode.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/ASTNode.cs 2009-05-05 15:38:45 UTC (rev 4245) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/ASTNode.cs 2009-05-05 18:07:06 UTC (rev 4246) @@ -262,6 +262,24 @@ return null; } + set + { + if (_parent != null) + { + if (_parent.ChildCount > (ChildIndex + 1)) + { + _parent.SetChild(ChildIndex + 1, value); + } + else + { + AddSibling(value); + } + } + else + { + throw new InvalidOperationException("Trying set NextSibling without a parent."); + } + } } public IASTNode GetChild(int index) Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/IASTNode.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/IASTNode.cs 2009-05-05 15:38:45 UTC (rev 4245) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/IASTNode.cs 2009-05-05 18:07:06 UTC (rev 4246) @@ -15,7 +15,7 @@ int ChildCount { get; } int ChildIndex { get; } IASTNode Parent { get; set; } - IASTNode NextSibling { get; } + IASTNode NextSibling { get; set; } IASTNode GetChild(int index); IASTNode GetFirstChild(); void SetFirstChild(IASTNode newChild); Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-05-05 15:38:45 UTC (rev 4245) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-05-05 18:07:06 UTC (rev 4246) @@ -589,6 +589,7 @@ <Compile Include="Hql\Ast\ANTLR\Util\JoinProcessor.cs" /> <Compile Include="Hql\Ast\ANTLR\Util\LiteralProcessor.cs" /> <Compile Include="Hql\Ast\ANTLR\Util\NodeTraverser.cs" /> + <Compile Include="Param\VersionTypeSeedParameterSpecification.cs" /> <Compile Include="SqlCommand\InsertSelect.cs" /> <Compile Include="Util\NullableDictionary.cs" /> <Compile Include="Hql\Ast\ANTLR\Util\PathHelper.cs" /> Added: trunk/nhibernate/src/NHibernate/Param/VersionTypeSeedParameterSpecification.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Param/VersionTypeSeedParameterSpecification.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Param/VersionTypeSeedParameterSpecification.cs 2009-05-05 18:07:06 UTC (rev 4246) @@ -0,0 +1,36 @@ +using System.Data; +using NHibernate.Engine; +using NHibernate.Type; + +namespace NHibernate.Param +{ + public class VersionTypeSeedParameterSpecification : IParameterSpecification + { + private readonly IVersionType type; + + public VersionTypeSeedParameterSpecification(IVersionType type) + { + this.type = type; + } + + public int Bind(IDbCommand statement, QueryParameters qp, ISessionImplementor session, int position) + { + type.NullSafeSet(statement, type.Seed(session), position, session); + return 1; + } + + public IType ExpectedType + { + get { return type; } + set + { + // expected type is intrinsic here... + } + } + + public string RenderDisplayInfo() + { + return "version-seed, type=" + type; + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-05 15:38:45 UTC (rev 4245) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-05 18:07:06 UTC (rev 4246) @@ -44,6 +44,81 @@ } } + [Test] + public void UpdateWithWhereExistsSubquery() + { + // multi-table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + var joe = new Human { Name = new Name { First = "Joe", Initial = 'Q', Last = "Public" } }; + s.Save(joe); + var doll = new Human {Name = new Name {First = "Kyu", Initial = 'P', Last = "Doll"}, Friends = new[] {joe}}; + s.Save(doll); + t.Commit(); + s.Close(); + + s = OpenSession(); + t = s.BeginTransaction(); + string updateQryString = "update Human h " + + "set h.description = 'updated' " + + "where exists (" + + " select f.id " + + " from h.friends f " + + " where f.name.last = 'Public' " + + ")"; + int count = s.CreateQuery(updateQryString).ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1)); + s.Delete(doll); + s.Delete(joe); + t.Commit(); + s.Close(); + + // single-table (one-to-many & many-to-many) ~~~~~~~~~~~~~~~~~~~~~~~~~~ + s = OpenSession(); + t = s.BeginTransaction(); + var entity = new SimpleEntityWithAssociation(); + var other = new SimpleEntityWithAssociation(); + entity.Name= "main"; + other.Name= "many-to-many-association"; + entity.ManyToManyAssociatedEntities.Add(other); + entity.AddAssociation("one-to-many-association"); + s.Save(entity); + t.Commit(); + s.Close(); + + s = OpenSession(); + t = s.BeginTransaction(); + // one-to-many test + updateQryString = "update SimpleEntityWithAssociation e " + + "set e.Name = 'updated' " + + "where exists (" + + " select a.id " + + " from e.AssociatedEntities a " + + " where a.Name = 'one-to-many-association' " + + ")"; + count = s.CreateQuery(updateQryString).ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1)); + // many-to-many test + if (Dialect.SupportsSubqueryOnMutatingTable) + { + updateQryString = "update SimpleEntityWithAssociation e " + + "set e.Name = 'updated' " + + "where exists (" + + " select a.id " + + " from e.ManyToManyAssociatedEntities a " + + " where a.Name = 'many-to-many-association' " + + ")"; + count = s.CreateQuery(updateQryString).ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1)); + } + var mtm = entity.ManyToManyAssociatedEntities.GetEnumerator(); + mtm.MoveNext(); + s.Delete(mtm.Current); + s.Delete(entity); + t.Commit(); + s.Close(); + } + #endregion #region DELETES This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-05 15:39:13
|
Revision: 4245 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4245&view=rev Author: fabiomaulo Date: 2009-05-05 15:38:45 +0000 (Tue, 05 May 2009) Log Message: ----------- Starting port of AST tests for Updates Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-05 13:34:01 UTC (rev 4244) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-05 15:38:45 UTC (rev 4245) @@ -34,6 +34,18 @@ #endregion + #region UPDATES + [Test] + public void IncorrectSyntax() + { + using(ISession s = OpenSession()) + { + Assert.Throws<QueryException>(() => s.CreateQuery("update Human set Human.description = 'xyz' where Human.id = 1 and Human.description is null")); + } + } + + #endregion + #region DELETES [Test] @@ -117,7 +129,7 @@ t.Commit(); s.Close(); data.Cleanup(); - } + } [Test] public void DeleteOnDiscriminatorSubclass() @@ -138,7 +150,7 @@ s.Close(); data.Cleanup(); - } + } [Test] public void DeleteOnJoinedSubclass() @@ -162,7 +174,7 @@ s.Close(); data.Cleanup(); - } + } [Test] public void DeleteOnMappedJoin() @@ -251,7 +263,7 @@ s.Close(); data.Cleanup(); - } + } [Test] public void DeleteRestrictedOnManyToOne() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-05 14:22:43
|
Revision: 4244 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4244&view=rev Author: fabiomaulo Date: 2009-05-05 13:34:01 +0000 (Tue, 05 May 2009) Log Message: ----------- Fixed syntax of HQL (same result for classic parser but now it work even for AST) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1556/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1556/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1556/Fixture.cs 2009-05-05 06:10:29 UTC (rev 4243) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1556/Fixture.cs 2009-05-05 13:34:01 UTC (rev 4244) @@ -71,7 +71,7 @@ session.CreateQuery( @"select p.Id, p.ProductName, max(c.LastFilled), count(c.Id) from Claim as c -from c.ProductIdentifier.Product as p +join c.ProductIdentifier.Product as p where c.Patient = :patient group by p.Id, p.ProductName order by max(c.LastFilled) asc, p.ProductName") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-05 06:10:40
|
Revision: 4243 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4243&view=rev Author: fabiomaulo Date: 2009-05-05 06:10:29 +0000 (Tue, 05 May 2009) Log Message: ----------- Continue porting HQL executable (update) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate/SqlCommand/InsertSelect.cs trunk/nhibernate/src/NHibernate/SqlCommand/SqlUpdateBuilder.cs Added Paths: ----------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/AssignmentSpecification.cs Added: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableUpdateExecutor.cs 2009-05-05 06:10:29 UTC (rev 4243) @@ -0,0 +1,190 @@ +using System; +using System.Collections.Generic; +using System.Data; +using log4net; +using NHibernate.Engine; +using NHibernate.Exceptions; +using NHibernate.Hql.Ast.ANTLR.Tree; +using NHibernate.Param; +using NHibernate.Persister.Entity; +using NHibernate.SqlCommand; +using NHibernate.SqlTypes; +using NHibernate.Util; + +namespace NHibernate.Hql.Ast.ANTLR.Exec +{ + [CLSCompliant(false)] + public class MultiTableUpdateExecutor : AbstractStatementExecutor + { + private static readonly ILog log = LogManager.GetLogger(typeof(MultiTableDeleteExecutor)); + private readonly IQueryable persister; + private readonly SqlString idInsertSelect; + private readonly SqlString[] updates; + private readonly IParameterSpecification[][] hqlParameters; + + public MultiTableUpdateExecutor(IStatement statement, ILog log) : base(statement, log) + { + if (!Factory.Dialect.SupportsTemporaryTables) + { + throw new HibernateException("cannot perform multi-table updates using dialect not supporting temp tables"); + } + var updateStatement = (UpdateStatement)statement; + + FromElement fromElement = updateStatement.FromClause.GetFromElement(); + string bulkTargetAlias = fromElement.TableAlias; + persister = fromElement.Queryable; + + idInsertSelect = GenerateIdInsertSelect(persister, bulkTargetAlias, updateStatement.WhereClause); + log.Debug("Generated ID-INSERT-SELECT SQL (multi-table update) : " + idInsertSelect); + + string[] tableNames = persister.ConstraintOrderedTableNameClosure; + string[][] columnNames = persister.ContraintOrderedTableKeyColumnClosure; + + string idSubselect = GenerateIdSubselect(persister); + var assignmentSpecifications = Walker.AssignmentSpecifications; + + updates = new SqlString[tableNames.Length]; + hqlParameters = new IParameterSpecification[tableNames.Length][]; + for (int tableIndex = 0; tableIndex < tableNames.Length; tableIndex++) + { + bool affected = false; + var parameterList = new List<IParameterSpecification>(); + SqlUpdateBuilder update = new SqlUpdateBuilder(Factory.Dialect, Factory) + .SetTableName(tableNames[tableIndex]) + .SetWhere("(" + StringHelper.Join(", ", columnNames[tableIndex]) + ") IN (" + idSubselect + ")"); + + if (Factory.Settings.IsCommentsEnabled) + { + update.SetComment("bulk update"); + } + foreach (var specification in assignmentSpecifications) + { + if (specification.AffectsTable(tableNames[tableIndex])) + { + affected = true; + update.AppendAssignmentFragment(specification.SqlAssignmentFragment); + if (specification.Parameters != null) + { + for (int paramIndex = 0; paramIndex < specification.Parameters.Length; paramIndex++) + { + parameterList.Add(specification.Parameters[paramIndex]); + } + } + } + } + if (affected) + { + updates[tableIndex] = update.ToSqlString(); + hqlParameters[tableIndex] = parameterList.ToArray(); + } + } + } + + public override SqlString[] SqlStatements + { + get { return updates; } + } + + public override int Execute(QueryParameters parameters, ISessionImplementor session) + { + CoordinateSharedCacheCleanup(session); + + CreateTemporaryTableIfNecessary(persister, session); + + try + { + // First, save off the pertinent ids, as the return value + IDbCommand ps = null; + int resultCount; + try + { + try + { + var parameterTypes = new List<SqlType>(Walker.Parameters.Count); + foreach (var parameterSpecification in Walker.Parameters) + { + parameterTypes.AddRange(parameterSpecification.ExpectedType.SqlTypes(Factory)); + } + + ps = session.Batcher.PrepareCommand(CommandType.Text, idInsertSelect, parameterTypes.ToArray()); + + int parameterStart = Walker.NumberOfParametersInSetClause; + + var allParams = Walker.Parameters; + + IEnumerator<IParameterSpecification> whereParams = + (new List<IParameterSpecification>(allParams)).GetRange(parameterStart, allParams.Count - parameterStart). + GetEnumerator(); + // NH Different behavior: The inital value is 0 (initialized to 1 in JAVA) + int pos = 0; + while (whereParams.MoveNext()) + { + var paramSpec = whereParams.Current; + pos += paramSpec.Bind(ps, parameters, session, pos); + } + resultCount = session.Batcher.ExecuteNonQuery(ps); + } + finally + { + if (ps != null) + { + session.Batcher.CloseCommand(ps, null); + } + } + } + catch (System.Data.OleDb.OleDbException e) + { + throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, e, "could not insert/select ids for bulk update", idInsertSelect); + } + + // Start performing the updates + for (int i = 0; i < updates.Length; i++) + { + if (updates[i] == null) + { + continue; + } + try + { + try + { + ps = session.Batcher.PrepareCommand(CommandType.Text, updates[i], new SqlType[0]); + + if (hqlParameters[i] != null) + { + int position = 1; // ADO params are 0-based + for (int x = 0; x < hqlParameters[i].Length; x++) + { + position += hqlParameters[i][x].Bind(ps, parameters, session, position); + } + } + session.Batcher.ExecuteNonQuery(ps); + } + finally + { + if (ps != null) + { + session.Batcher.CloseCommand(ps, null); + } + } + } + catch (System.Data.OleDb.OleDbException e) + { + throw ADOExceptionHelper.Convert(Factory.SQLExceptionConverter, e, "error performing bulk update", updates[i]); + } + } + + return resultCount; + } + finally + { + DropTemporaryTableIfNecessary(persister, session); + } + } + + protected override IQueryable[] AffectedQueryables + { + get { return new[] { persister }; } + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs 2009-05-05 04:15:19 UTC (rev 4242) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs 2009-05-05 06:10:29 UTC (rev 4243) @@ -53,6 +53,8 @@ private IParseErrorHandler _parseErrorHandler = new ErrorCounter(); private IASTFactory _nodeFactory; + private readonly List<AssignmentSpecification> assignmentSpecifications = new List<AssignmentSpecification>(); + private int numberOfParametersInSetClause; public HqlSqlWalker(QueryTranslatorImpl qti, ISessionFactoryImplementor sfi, @@ -68,6 +70,16 @@ _collectionFilterRole = collectionRole; } + public IList<AssignmentSpecification> AssignmentSpecifications + { + get { return assignmentSpecifications; } + } + + public int NumberOfParametersInSetClause + { + get { return numberOfParametersInSetClause; } + } + public IParseErrorHandler ParseErrorHandler { get { return _parseErrorHandler; } @@ -333,11 +345,31 @@ constructorNode.Prepare(); } - static void EvaluateAssignment(IASTNode eq) + protected void EvaluateAssignment(IASTNode eq) { - throw new NotImplementedException(); // DML + PrepareLogicOperator(eq); + IQueryable persister = CurrentFromClause.GetFromElement().Queryable; + EvaluateAssignment(eq, persister, -1); } + private void EvaluateAssignment(IASTNode eq, IQueryable persister, int targetIndex) + { + if (persister.IsMultiTable) + { + // no need to even collect this information if the persister is considered multi-table + var specification = new AssignmentSpecification(eq, persister); + if (targetIndex >= 0) + { + assignmentSpecifications.Insert(targetIndex, specification); + } + else + { + assignmentSpecifications.Add(specification); + } + numberOfParametersInSetClause += specification.Parameters.Length; + } + } + void BeforeSelectClause() { // Turn off includeSubclasses on all FromElements. Added: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/AssignmentSpecification.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/AssignmentSpecification.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/AssignmentSpecification.cs 2009-05-05 06:10:29 UTC (rev 4243) @@ -0,0 +1,143 @@ +using System; +using Antlr.Runtime.Tree; +using Iesi.Collections.Generic; +using NHibernate.Engine; +using NHibernate.Hql.Ast.ANTLR.Util; +using NHibernate.Param; +using NHibernate.Persister.Entity; +using NHibernate.SqlCommand; + +namespace NHibernate.Hql.Ast.ANTLR.Tree +{ + /// <summary> + /// Encapsulates the information relating to an individual assignment within the + /// set clause of an HQL update statement. This information is used during execution + /// of the update statements when the updates occur against "multi-table" stuff. + /// </summary> + [CLSCompliant(false)] + public class AssignmentSpecification + { + private readonly IASTNode eq; + private readonly ISessionFactoryImplementor factory; + private readonly ISet<string> tableNames; + private readonly IParameterSpecification[] hqlParameters; + private SqlString sqlAssignmentString; + + public AssignmentSpecification(IASTNode eq, IQueryable persister) + { + if (eq.Type != HqlSqlWalker.EQ) + { + throw new QueryException("assignment in set-clause not associated with equals"); + } + + this.eq = eq; + factory = persister.Factory; + + // Needed to bump this up to DotNode, because that is the only thing which currently + // knows about the property-ref path in the correct format; it is either this, or + // recurse over the DotNodes constructing the property path just like DotNode does + // internally + var lhs = (DotNode)eq.GetFirstChild(); + var rhs = (SqlNode)lhs.NextSibling; + + ValidateLhs(lhs); + + string propertyPath = lhs.PropertyPath; + var temp = new HashedSet<string>(); + // yuck! + var usep = persister as UnionSubclassEntityPersister; + if (usep!=null) + { + temp.AddAll(persister.ConstraintOrderedTableNameClosure); + } + else + { + temp.Add(persister.GetSubclassTableName(persister.GetSubclassPropertyTableNumber(propertyPath))); + } + tableNames = new ImmutableSet<string>(temp); + + if (rhs == null) + { + hqlParameters = new IParameterSpecification[0]; + } + else if (IsParam(rhs)) + { + hqlParameters = new[] { ((ParameterNode)rhs).HqlParameterSpecification }; + } + else + { + var parameterList = ASTUtil.CollectChildren(rhs, IsParam); + hqlParameters = new IParameterSpecification[parameterList.Count]; + int i = 0; + foreach (ParameterNode parameterNode in parameterList) + { + hqlParameters[i++] = parameterNode.HqlParameterSpecification; + } + } + } + public bool AffectsTable(string tableName) + { + return tableNames.Contains(tableName); + } + + private static bool IsParam(IASTNode node) + { + return node.Type == HqlSqlWalker.PARAM || node.Type == HqlSqlWalker.NAMED_PARAM; + } + + private static void ValidateLhs(FromReferenceNode lhs) + { + // make sure the lhs is "assignable"... + if (!lhs.IsResolved) + { + throw new NotSupportedException("cannot validate assignablity of unresolved node"); + } + + if (lhs.DataType.IsCollectionType) + { + throw new QueryException("collections not assignable in update statements"); + } + else if (lhs.DataType.IsComponentType) + { + throw new QueryException("Components currently not assignable in update statements"); + } + else if (lhs.DataType.IsEntityType) + { + // currently allowed... + } + + // TODO : why aren't these the same? + if (lhs.GetImpliedJoin() != null || lhs.FromElement.IsImplied) + { + throw new QueryException("Implied join paths are not assignable in update statements"); + } + } + + public IParameterSpecification[] Parameters + { + get{return hqlParameters;} + } + + public SqlString SqlAssignmentFragment + { + get + { + if (sqlAssignmentString == null) + { + try + { + var gen = new SqlGenerator(factory, new CommonTreeNodeStream(eq)); + gen.comparisonExpr(false); // false indicates to not generate parens around the assignment + sqlAssignmentString = gen.GetSQL(); + } + catch (Exception t) + { + throw new QueryException("cannot interpret set-clause assignment", t); + } + } + return sqlAssignmentString; + } + + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-05-05 04:15:19 UTC (rev 4242) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-05-05 06:10:29 UTC (rev 4243) @@ -484,6 +484,7 @@ <Compile Include="Hql\Ast\ANTLR\Exec\BasicExecutor.cs" /> <Compile Include="Hql\Ast\ANTLR\Exec\IStatementExecutor.cs" /> <Compile Include="Hql\Ast\ANTLR\Exec\MultiTableDeleteExecutor.cs" /> + <Compile Include="Hql\Ast\ANTLR\Exec\MultiTableUpdateExecutor.cs" /> <Compile Include="Hql\Ast\ANTLR\Generated\HqlLexer.cs" /> <Compile Include="Hql\Ast\ANTLR\Generated\HqlParser.cs" /> <Compile Include="Hql\Ast\ANTLR\Generated\HqlSqlWalker.cs" /> @@ -497,6 +498,7 @@ <Compile Include="Hql\Ast\ANTLR\InvalidWithClauseException.cs" /> <Compile Include="Hql\Ast\ANTLR\IParseErrorHandler.cs" /> <Compile Include="Hql\Ast\ANTLR\Loader\QueryLoader.cs" /> + <Compile Include="Hql\Ast\ANTLR\Tree\AssignmentSpecification.cs" /> <Compile Include="Hql\Ast\ANTLR\Tree\InsertStatement.cs" /> <Compile Include="Hql\Ast\ANTLR\Tree\UpdateStatement.cs" /> <Compile Include="Param\AbstractExplicitParameterSpecification.cs" /> Modified: trunk/nhibernate/src/NHibernate/SqlCommand/InsertSelect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/SqlCommand/InsertSelect.cs 2009-05-05 04:15:19 UTC (rev 4242) +++ trunk/nhibernate/src/NHibernate/SqlCommand/InsertSelect.cs 2009-05-05 06:10:29 UTC (rev 4243) @@ -1,6 +1,5 @@ using System.Collections.Generic; using log4net; -using NHibernate.Engine; namespace NHibernate.SqlCommand { @@ -8,7 +7,6 @@ { private static readonly ILog log = LogManager.GetLogger(typeof(InsertSelect)); - private readonly ISessionFactoryImplementor factory; private string tableName; private string comment; private readonly List<string> columnNames = new List<string>(); Modified: trunk/nhibernate/src/NHibernate/SqlCommand/SqlUpdateBuilder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/SqlCommand/SqlUpdateBuilder.cs 2009-05-05 04:15:19 UTC (rev 4242) +++ trunk/nhibernate/src/NHibernate/SqlCommand/SqlUpdateBuilder.cs 2009-05-05 06:10:29 UTC (rev 4243) @@ -20,8 +20,9 @@ // columns-> (ColumnName, Value) or (ColumnName, SqlType) for parametrized column private readonly LinkedHashMap<string, object> columns = new LinkedHashMap<string, object>(); - private readonly List<SqlString> whereStrings = new List<SqlString>(); + private List<SqlString> whereStrings = new List<SqlString>(); private readonly List<SqlType> whereParameterTypes = new List<SqlType>(); + private SqlString assignments; public SqlUpdateBuilder(Dialect.Dialect dialect, IMapping mapping) : base(dialect, mapping) {} @@ -120,6 +121,28 @@ return this; } + public SqlUpdateBuilder AppendAssignmentFragment(SqlString fragment) + { + if (assignments == null) + { + assignments = fragment; + } + else + { + assignments.Append(", ").Append(fragment); + } + return this; + } + + public SqlUpdateBuilder SetWhere(string whereSql) + { + if (StringHelper.IsNotEmpty(whereSql)) + { + whereStrings = new List<SqlString>(new[] { new SqlString(whereSql) }); + } + return this; + } + /// <summary> /// Sets the IdentityColumn for the <c>UPDATE</c> sql to use. /// </summary> @@ -229,7 +252,7 @@ if (!string.IsNullOrEmpty(comment)) initialCapacity++; - SqlStringBuilder sqlBuilder = new SqlStringBuilder(initialCapacity + 2); + var sqlBuilder = new SqlStringBuilder(initialCapacity + 2); if (!string.IsNullOrEmpty(comment)) sqlBuilder.Add("/* " + comment + " */ "); @@ -237,6 +260,7 @@ .Add(tableName) .Add(" SET "); + bool assignmentsAppended = false; bool commaNeeded = false; foreach (KeyValuePair<string, object> valuePair in columns) { @@ -253,7 +277,16 @@ sqlBuilder.Add(Parameter.Placeholder); else sqlBuilder.Add((string) valuePair.Value); + assignmentsAppended = true; } + if (assignments != null) + { + if (assignmentsAppended) + { + sqlBuilder.Add(", "); + } + sqlBuilder.Add(assignments); + } sqlBuilder.Add(" WHERE "); bool andNeeded = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-05 04:15:29
|
Revision: 4242 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4242&view=rev Author: fabiomaulo Date: 2009-05-05 04:15:19 +0000 (Tue, 05 May 2009) Log Message: ----------- preparing porting for insert/update HQL Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableDeleteExecutor.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DeleteStatement.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/HqlSqlWalkerTreeAdapter.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/InsertStatement.cs trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/UpdateStatement.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableDeleteExecutor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableDeleteExecutor.cs 2009-05-04 23:46:25 UTC (rev 4241) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Exec/MultiTableDeleteExecutor.cs 2009-05-05 04:15:19 UTC (rev 4242) @@ -14,6 +14,7 @@ namespace NHibernate.Hql.Ast.ANTLR.Exec { + [CLSCompliant(false)] public class MultiTableDeleteExecutor : AbstractStatementExecutor { private static readonly ILog log = LogManager.GetLogger(typeof(MultiTableDeleteExecutor)); Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DeleteStatement.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DeleteStatement.cs 2009-05-04 23:46:25 UTC (rev 4241) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/DeleteStatement.cs 2009-05-05 04:15:19 UTC (rev 4242) @@ -11,7 +11,7 @@ [CLSCompliant(false)] public class DeleteStatement : AbstractRestrictableStatement { - private static readonly ILog log = LogManager.GetLogger(typeof(QueryNode)); + private static readonly ILog log = LogManager.GetLogger(typeof(DeleteStatement)); public DeleteStatement(IToken token) : base(token) {} Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/HqlSqlWalkerTreeAdapter.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/HqlSqlWalkerTreeAdapter.cs 2009-05-04 23:46:25 UTC (rev 4241) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/HqlSqlWalkerTreeAdapter.cs 2009-05-05 04:15:19 UTC (rev 4242) @@ -29,15 +29,13 @@ ret = new QueryNode(payload); break; case HqlSqlWalker.UPDATE: - //return UpdateStatement.class; - ret = new SqlNode(payload); + ret = new UpdateStatement(payload); break; case HqlSqlWalker.DELETE: ret = new DeleteStatement(payload); break; case HqlSqlWalker.INSERT: - //return InsertStatement.class; - ret = new SqlNode(payload); + ret = new InsertStatement(payload); break; case HqlSqlWalker.INTO: ret = new IntoClause(payload); @@ -57,7 +55,7 @@ case HqlSqlWalker.INDEX_OP: ret = new IndexNode(payload); break; - // Alias references and identifiers use the same node class. + // Alias references and identifiers use the same node class. case HqlSqlWalker.ALIAS_REF: case HqlSqlWalker.IDENT: ret = new IdentNode(payload); @@ -154,7 +152,6 @@ default: ret = new SqlNode(payload); break; - } Initialise(ret); @@ -163,11 +160,11 @@ public override object DupNode(object t) { - IASTNode node = t as IASTNode; + var node = t as IASTNode; if (node != null) { - IASTNode dupped = (IASTNode)Create(node.Token); + var dupped = (IASTNode) Create(node.Token); dupped.Parent = node.Parent; @@ -179,16 +176,16 @@ } } - void Initialise(object node) + private void Initialise(object node) { - IInitializableNode initableNode = node as IInitializableNode; + var initableNode = node as IInitializableNode; if (initableNode != null) { initableNode.Initialize(_walker); } - ISessionFactoryAwareNode sessionNode = node as ISessionFactoryAwareNode; + var sessionNode = node as ISessionFactoryAwareNode; if (sessionNode != null) { @@ -196,4 +193,4 @@ } } } -} +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/InsertStatement.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/InsertStatement.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/InsertStatement.cs 2009-05-05 04:15:19 UTC (rev 4242) @@ -0,0 +1,45 @@ +using System; +using Antlr.Runtime; + +namespace NHibernate.Hql.Ast.ANTLR.Tree +{ + /// <summary> + /// Defines a top-level AST node representing an HQL "insert select" statement. + /// </summary> + [Serializable] + [CLSCompliant(false)] + public class InsertStatement : AbstractStatement + { + public InsertStatement(IToken token) : base(token) {} + public override bool NeedsExecutor + { + get { return true; } + } + + public override int StatementType + { + get { return HqlSqlWalker.INSERT; } + } + + /// <summary> Retreive this insert statement's into-clause. </summary> + /// <returns> The into-clause </returns> + public IntoClause IntoClause + { + get{return (IntoClause)GetFirstChild();} + } + + /// <summary> Retreive this insert statement's select-clause.</summary> + /// <returns> The select-clause. </returns> + public SelectClause SelectClause + { + get{return ((QueryNode)IntoClause.NextSibling).GetSelectClause();} + } + + /// <summary> Performs detailed semantic validation on this insert statement tree. </summary> + /// <exception cref="QueryException">Indicates validation failure.</exception> + public virtual void Validate() + { + IntoClause.ValidateTypes(SelectClause); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/UpdateStatement.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/UpdateStatement.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Tree/UpdateStatement.cs 2009-05-05 04:15:19 UTC (rev 4242) @@ -0,0 +1,44 @@ +using System; +using Antlr.Runtime; +using log4net; +using NHibernate.Hql.Ast.ANTLR.Util; + +namespace NHibernate.Hql.Ast.ANTLR.Tree +{ + /// <summary> + /// Defines a top-level AST node representing an HQL update statement. + /// </summary> + [Serializable] + [CLSCompliant(false)] + public class UpdateStatement : AbstractRestrictableStatement + { + private static readonly ILog log = LogManager.GetLogger(typeof (UpdateStatement)); + + public UpdateStatement(IToken token) : base(token) {} + + public override bool NeedsExecutor + { + get { return true; } + } + + public override int StatementType + { + get { return HqlSqlWalker.UPDATE; } + } + + public IASTNode SetClause + { + get { return ASTUtil.FindTypeInChildren(this, HqlSqlWalker.SET); } + } + + protected override ILog GetLog() + { + return log; + } + + protected override int GetWhereClauseParentTokenType() + { + return HqlSqlWalker.SET; + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-05-04 23:46:25 UTC (rev 4241) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-05-05 04:15:19 UTC (rev 4242) @@ -497,6 +497,8 @@ <Compile Include="Hql\Ast\ANTLR\InvalidWithClauseException.cs" /> <Compile Include="Hql\Ast\ANTLR\IParseErrorHandler.cs" /> <Compile Include="Hql\Ast\ANTLR\Loader\QueryLoader.cs" /> + <Compile Include="Hql\Ast\ANTLR\Tree\InsertStatement.cs" /> + <Compile Include="Hql\Ast\ANTLR\Tree\UpdateStatement.cs" /> <Compile Include="Param\AbstractExplicitParameterSpecification.cs" /> <Compile Include="Param\AggregatedIndexCollectionSelectorParameterSpecifications.cs" /> <Compile Include="Param\CollectionFilterKeyParameterSpecification.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-04 23:46:32
|
Revision: 4241 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4241&view=rev Author: fabiomaulo Date: 2009-05-04 23:46:25 +0000 (Mon, 04 May 2009) Log Message: ----------- Minor Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-04 23:45:28 UTC (rev 4240) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-04 23:46:25 UTC (rev 4241) @@ -1,5 +1,4 @@ using System.Collections; -using System.Diagnostics; using NUnit.Framework; using NHibernate.Hql.Ast.ANTLR; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-04 23:45:32
|
Revision: 4240 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4240&view=rev Author: fabiomaulo Date: 2009-05-04 23:45:28 +0000 (Mon, 04 May 2009) Log Message: ----------- End porting tests for DELETE executable HQL Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleAssociatedEntity.cs trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-04 23:18:12 UTC (rev 4239) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-04 23:45:28 UTC (rev 4240) @@ -35,7 +35,49 @@ #endregion + #region DELETES + [Test] + public void DeleteWithSubquery() + { + // setup the test data... + ISession s = OpenSession(); + s.BeginTransaction(); + var owner = new SimpleEntityWithAssociation { Name = "myEntity-1" }; + owner.AddAssociation("assoc-1"); + owner.AddAssociation("assoc-2"); + owner.AddAssociation("assoc-3"); + s.Save(owner); + var owner2 = new SimpleEntityWithAssociation { Name = "myEntity-2" }; + owner2.AddAssociation("assoc-1"); + owner2.AddAssociation("assoc-2"); + owner2.AddAssociation("assoc-3"); + owner2.AddAssociation("assoc-4"); + s.Save(owner2); + var owner3 = new SimpleEntityWithAssociation { Name = "myEntity-3" }; + s.Save(owner3); + s.Transaction.Commit(); + s.Close(); + + // now try the bulk delete + s = OpenSession(); + s.BeginTransaction(); + int count = s.CreateQuery("delete SimpleEntityWithAssociation e where size(e.AssociatedEntities ) = 0 and e.Name like '%'") + .ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect delete count"); + s.Transaction.Commit(); + s.Close(); + + // finally, clean up + s = OpenSession(); + s.BeginTransaction(); + s.CreateQuery("delete SimpleAssociatedEntity").ExecuteUpdate(); + s.CreateQuery("delete SimpleEntityWithAssociation").ExecuteUpdate(); + s.Transaction.Commit(); + s.Close(); + } + + [Test] public void SimpleDeleteOnAnimal() { if (Dialect.HasSelfReferentialForeignKeyBug) @@ -246,6 +288,8 @@ s.Close(); } + #endregion + private class TestData { private readonly BulkManipulation tc; Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleAssociatedEntity.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleAssociatedEntity.cs 2009-05-04 23:18:12 UTC (rev 4239) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleAssociatedEntity.cs 2009-05-04 23:45:28 UTC (rev 4240) @@ -30,12 +30,12 @@ if (owner != this.owner) { UnbindFromCurrentOwner(); - if (owner != null) - { - owner.AssociatedEntities.Add(this); - } } this.owner = owner; + if (owner != null) + { + owner.AssociatedEntities.Add(this); + } } public virtual void UnbindFromCurrentOwner() Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.cs 2009-05-04 23:18:12 UTC (rev 4239) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/SimpleEntityWithAssociation.cs 2009-05-04 23:45:28 UTC (rev 4240) @@ -1,3 +1,4 @@ +using System; using Iesi.Collections; namespace NHibernate.Test.HQL.Ast @@ -32,5 +33,29 @@ get { return manyToManyAssociatedEntities; } set { manyToManyAssociatedEntities = value; } } + + public virtual SimpleAssociatedEntity AddAssociation(string aName) + { + var result = new SimpleAssociatedEntity {Name = aName, Owner = this}; + AddAssociation(result); + return result; + } + + public virtual void AddAssociation(SimpleAssociatedEntity association) + { + association.BindToOwner(this); + } + + public virtual void RemoveAssociation(SimpleAssociatedEntity association) + { + if (AssociatedEntities.Contains(association)) + { + association.UnbindFromCurrentOwner(); + } + else + { + throw new ArgumentException("SimpleAssociatedEntity [" + association + "] not currently bound to this [" + this + "]"); + } + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-05-04 23:18:18
|
Revision: 4239 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4239&view=rev Author: fabiomaulo Date: 2009-05-04 23:18:12 +0000 (Mon, 04 May 2009) Log Message: ----------- Continue porting HQL executable (delete tests) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-04 23:06:06 UTC (rev 4238) +++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2009-05-04 23:18:12 UTC (rev 4239) @@ -1,3 +1,5 @@ +using System.Collections; +using System.Diagnostics; using NUnit.Framework; using NHibernate.Hql.Ast.ANTLR; @@ -32,7 +34,51 @@ } #endregion + [Test] + public void SimpleDeleteOnAnimal() + { + if (Dialect.HasSelfReferentialForeignKeyBug) + { + Assert.Ignore("self referential FK bug", "HQL delete testing"); + return; + } + + var data = new TestData(this); + data.Prepare(); + + ISession s = OpenSession(); + ITransaction t = s.BeginTransaction(); + + int count = s.CreateQuery("delete from Animal as a where a.id = :id") + .SetInt64("id", data.Polliwog.Id) + .ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect delete count"); + + count = s.CreateQuery("delete Animal where id = :id") + .SetInt64("id", data.Catepillar.Id) + .ExecuteUpdate(); + Assert.That(count, Is.EqualTo(1), "Incorrect delete count"); + + // HHH-873... + if (Dialect.SupportsSubqueryOnMutatingTable) + { + count = s.CreateQuery("delete from User u where u not in (select u from User u)").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(0)); + } + + count = s.CreateQuery("delete Animal a").ExecuteUpdate(); + Assert.That(count, Is.EqualTo(4), "Incorrect delete count"); + + IList list = s.CreateQuery("select a from Animal as a").List(); + Assert.That(list, Is.Empty, "table not empty"); + + t.Commit(); + s.Close(); + data.Cleanup(); + } + + [Test] public void DeleteOnDiscriminatorSubclass() { var data = new TestData(this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |