|
From: <pa...@us...> - 2011-04-12 11:09:05
|
Revision: 5674
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5674&view=rev
Author: patearl
Date: 2011-04-12 11:08:59 +0000 (Tue, 12 Apr 2011)
Log Message:
-----------
Tests: SQLite does not support having without group by.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/Hql/HQLFunctions.cs
trunk/nhibernate/src/NHibernate.Test/TestDialect.cs
trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs
Modified: trunk/nhibernate/src/NHibernate.Test/Hql/HQLFunctions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Hql/HQLFunctions.cs 2011-04-12 09:36:48 UTC (rev 5673)
+++ trunk/nhibernate/src/NHibernate.Test/Hql/HQLFunctions.cs 2011-04-12 11:08:59 UTC (rev 5674)
@@ -85,9 +85,12 @@
Assert.AreEqual(2, result);
// Count in where
- result = s.CreateQuery("select count(a.id) from Animal a having count(a.id)>1").UniqueResult();
- Assert.AreEqual(typeof(long), result.GetType());
- Assert.AreEqual(2, result);
+ if (TestDialect.SupportsHavingWithoutGroupBy)
+ {
+ result = s.CreateQuery("select count(a.id) from Animal a having count(a.id)>1").UniqueResult();
+ Assert.AreEqual(typeof (long), result.GetType());
+ Assert.AreEqual(2, result);
+ }
}
}
@@ -110,9 +113,12 @@
Assert.AreEqual(15D, result);
// In where
- result = s.CreateQuery("select avg(a.BodyWeight) from Animal a having avg(a.BodyWeight)>0").UniqueResult();
- Assert.AreEqual(typeof(double), result.GetType());
- Assert.AreEqual(15D, result);
+ if (TestDialect.SupportsHavingWithoutGroupBy)
+ {
+ result = s.CreateQuery("select avg(a.BodyWeight) from Animal a having avg(a.BodyWeight)>0").UniqueResult();
+ Assert.AreEqual(typeof(double), result.GetType());
+ Assert.AreEqual(15D, result);
+ }
}
}
@@ -133,9 +139,12 @@
Assert.AreEqual(typeof(float), result.GetType()); //use column type
Assert.AreEqual(20F, result);
- result = s.CreateQuery("select max(a.BodyWeight) from Animal a having max(a.BodyWeight)>0").UniqueResult();
- Assert.AreEqual(typeof(float), result.GetType()); //use column type
- Assert.AreEqual(20F, result);
+ if (TestDialect.SupportsHavingWithoutGroupBy)
+ {
+ result = s.CreateQuery("select max(a.BodyWeight) from Animal a having max(a.BodyWeight)>0").UniqueResult();
+ Assert.AreEqual(typeof(float), result.GetType()); //use column type
+ Assert.AreEqual(20F, result);
+ }
}
}
@@ -156,9 +165,12 @@
Assert.AreEqual(typeof(float), result.GetType()); //use column type
Assert.AreEqual(10F, result);
- result = s.CreateQuery("select min(a.BodyWeight) from Animal a having min(a.BodyWeight)>0").UniqueResult();
- Assert.AreEqual(typeof(float), result.GetType()); //use column type
- Assert.AreEqual(10F, result);
+ if (TestDialect.SupportsHavingWithoutGroupBy)
+ {
+ result = s.CreateQuery("select min(a.BodyWeight) from Animal a having min(a.BodyWeight)>0").UniqueResult();
+ Assert.AreEqual(typeof(float), result.GetType()); //use column type
+ Assert.AreEqual(10F, result);
+ }
}
}
@@ -179,9 +191,12 @@
Assert.AreEqual(typeof(double), result.GetType());
Assert.AreEqual(30D, result);
- result = s.CreateQuery("select sum(a.BodyWeight) from Animal a having sum(a.BodyWeight)>0").UniqueResult();
- Assert.AreEqual(typeof(double), result.GetType());
- Assert.AreEqual(30D, result);
+ if (TestDialect.SupportsHavingWithoutGroupBy)
+ {
+ result = s.CreateQuery("select sum(a.BodyWeight) from Animal a having sum(a.BodyWeight)>0").UniqueResult();
+ Assert.AreEqual(typeof(double), result.GetType());
+ Assert.AreEqual(30D, result);
+ }
}
}
Modified: trunk/nhibernate/src/NHibernate.Test/TestDialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TestDialect.cs 2011-04-12 09:36:48 UTC (rev 5673)
+++ trunk/nhibernate/src/NHibernate.Test/TestDialect.cs 2011-04-12 11:08:59 UTC (rev 5674)
@@ -49,6 +49,8 @@
public virtual bool SupportsSelectForUpdateOnOuterJoin { get { return true; } }
+ public virtual bool SupportsHavingWithoutGroupBy { get { return true; } }
+
public bool SupportsSqlType(SqlType sqlType)
{
try
Modified: trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs 2011-04-12 09:36:48 UTC (rev 5673)
+++ trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs 2011-04-12 11:08:59 UTC (rev 5674)
@@ -46,5 +46,10 @@
{
get { return true; }
}
+
+ public override bool SupportsHavingWithoutGroupBy
+ {
+ get { return false; }
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|