@@ -21,7 +21,15 @@ static HQLFunctions()
2121 { "locate" , new [ ] { typeof ( SQLiteDialect ) } } ,
2222 { "bit_length" , new [ ] { typeof ( SQLiteDialect ) } } ,
2323 { "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+ } }
2533 } ;
2634 }
2735
@@ -74,9 +82,13 @@ public void AggregateCount()
7482 using ( ISession s = OpenSession ( ) )
7583 {
7684 // 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+ }
8092
8193 result = s . CreateQuery ( "select count(*) from Animal" ) . UniqueResult ( ) ;
8294 Assert . AreEqual ( typeof ( long ) , result . GetType ( ) ) ;
@@ -758,6 +770,17 @@ public void Cast()
758770 if ( ! ex . InnerException . Message . Contains ( msgToCheck ) )
759771 throw ;
760772 }
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+ }
761784 else
762785 {
763786 string msgToCheck =
@@ -864,6 +887,7 @@ public void Current_TimeStamp_Offset()
864887 public void Extract ( )
865888 {
866889 IgnoreIfNotSupported ( "extract" ) ;
890+ IgnoreIfNotSupported ( "current_timestamp" ) ;
867891
868892 // test only the parser and render
869893 using ( ISession s = OpenSession ( ) )
@@ -906,6 +930,9 @@ public void Concat()
906930 public void HourMinuteSecond ( )
907931 {
908932 IgnoreIfNotSupported ( "second" ) ;
933+ IgnoreIfNotSupported ( "minute" ) ;
934+ IgnoreIfNotSupported ( "hour" ) ;
935+ IgnoreIfNotSupported ( "current_timestamp" ) ;
909936 // test only the parser and render
910937 using ( ISession s = OpenSession ( ) )
911938 {
@@ -997,6 +1024,7 @@ from MaterialResource mr
9971024 [ Test ]
9981025 public void NH1725 ( )
9991026 {
1027+ IgnoreIfNotSupported ( "iif" ) ;
10001028 // Only to test the parser
10011029 using ( ISession s = OpenSession ( ) )
10021030 {
0 commit comments