@@ -21,7 +21,15 @@ static HQLFunctions()
21
21
{ "locate" , new [ ] { typeof ( SQLiteDialect ) } } ,
22
22
{ "bit_length" , new [ ] { typeof ( SQLiteDialect ) } } ,
23
23
{ "extract" , new [ ] { typeof ( SQLiteDialect ) } } ,
24
- { "nullif" , new [ ] { typeof ( Oracle8iDialect ) } }
24
+ {
25
+ "nullif" ,
26
+ new [ ]
27
+ {
28
+ typeof ( Oracle8iDialect ) ,
29
+ // Actually not supported by the db engine. (Well, could likely still be done with a case when override.)
30
+ typeof ( MsSqlCeDialect ) ,
31
+ typeof ( MsSqlCe40Dialect )
32
+ } }
25
33
} ;
26
34
}
27
35
@@ -74,9 +82,13 @@ public void AggregateCount()
74
82
using ( ISession s = OpenSession ( ) )
75
83
{
76
84
// Count in select
77
- object result = s . CreateQuery ( "select count(distinct a.id) from Animal a" ) . UniqueResult ( ) ;
78
- Assert . AreEqual ( typeof ( long ) , result . GetType ( ) ) ;
79
- Assert . AreEqual ( 2 , result ) ;
85
+ object result ;
86
+ if ( TestDialect . SupportsCountDistinct )
87
+ {
88
+ result = s . CreateQuery ( "select count(distinct a.id) from Animal a" ) . UniqueResult ( ) ;
89
+ Assert . AreEqual ( typeof ( long ) , result . GetType ( ) ) ;
90
+ Assert . AreEqual ( 2 , result ) ;
91
+ }
80
92
81
93
result = s . CreateQuery ( "select count(*) from Animal" ) . UniqueResult ( ) ;
82
94
Assert . AreEqual ( typeof ( long ) , result . GetType ( ) ) ;
@@ -758,6 +770,17 @@ public void Cast()
758
770
if ( ! ex . InnerException . Message . Contains ( msgToCheck ) )
759
771
throw ;
760
772
}
773
+ else if ( Dialect is MsSqlCeDialect )
774
+ {
775
+ var errorCodeProperty = ex . InnerException . GetType ( ) . GetProperty ( "NativeError" ) ;
776
+ if ( errorCodeProperty == null ||
777
+ // 25515 is the error code for "In aggregate and grouping expressions, the SELECT clause can contain only aggregates and grouping expressions."
778
+ // https://technet.microsoft.com/en-us/library/ms172350(v=sql.110).aspx
779
+ errorCodeProperty . GetValue ( ex . InnerException ) as int ? != 25515 )
780
+ {
781
+ throw ;
782
+ }
783
+ }
761
784
else
762
785
{
763
786
string msgToCheck =
@@ -864,6 +887,7 @@ public void Current_TimeStamp_Offset()
864
887
public void Extract ( )
865
888
{
866
889
IgnoreIfNotSupported ( "extract" ) ;
890
+ IgnoreIfNotSupported ( "current_timestamp" ) ;
867
891
868
892
// test only the parser and render
869
893
using ( ISession s = OpenSession ( ) )
@@ -906,6 +930,9 @@ public void Concat()
906
930
public void HourMinuteSecond ( )
907
931
{
908
932
IgnoreIfNotSupported ( "second" ) ;
933
+ IgnoreIfNotSupported ( "minute" ) ;
934
+ IgnoreIfNotSupported ( "hour" ) ;
935
+ IgnoreIfNotSupported ( "current_timestamp" ) ;
909
936
// test only the parser and render
910
937
using ( ISession s = OpenSession ( ) )
911
938
{
@@ -997,6 +1024,7 @@ from MaterialResource mr
997
1024
[ Test ]
998
1025
public void NH1725 ( )
999
1026
{
1027
+ IgnoreIfNotSupported ( "iif" ) ;
1000
1028
// Only to test the parser
1001
1029
using ( ISession s = OpenSession ( ) )
1002
1030
{
0 commit comments