Skip to content

Commit 26eeb25

Browse files
NH-4070 - Add missing function overrides to MsSqlCe
1 parent 17b038f commit 26eeb25

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/NHibernate/Dialect/MsSqlCeDialect.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ protected virtual void RegisterFunctions()
170170
RegisterFunction("substring", new EmulatedLengthSubstringFunction());
171171
RegisterFunction("str", new SQLFunctionTemplate(NHibernateUtil.String, "cast(?1 as nvarchar)"));
172172

173+
RegisterFunction("current_timestamp", new NoArgSQLFunction("getdate", NHibernateUtil.DateTime, true));
173174
RegisterFunction("date", new SQLFunctionTemplate(NHibernateUtil.DateTime, "dateadd(dd, 0, datediff(dd, 0, ?1))"));
174175
RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(second, ?1)"));
175176
RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(minute, ?1)"));
@@ -187,10 +188,15 @@ protected virtual void RegisterFunctions()
187188
RegisterFunction("lower", new StandardSQLFunction("lower"));
188189

189190
RegisterFunction("trim", new AnsiTrimEmulationFunction());
191+
RegisterFunction("iif", new SQLFunctionTemplate(null, "case when ?1 then ?2 else ?3 end"));
190192

191193
RegisterFunction("concat", new VarArgsSQLFunction(NHibernateUtil.String, "(", "+", ")"));
194+
RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "((?1) % (?2))"));
192195

193196
RegisterFunction("round", new StandardSQLFunction("round"));
197+
198+
RegisterFunction("bit_length", new SQLFunctionTemplate(NHibernateUtil.Int32, "datalength(?1) * 8"));
199+
RegisterFunction("extract", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(?1, ?3)"));
194200
}
195201

196202
protected virtual void RegisterDefaultProperties()

0 commit comments

Comments
 (0)