Skip to content

Commit c2b7335

Browse files
committed
PostgreSQLDialect.cs: Define trigonometric functions. Tests covered by Linq.MathTests. NH-3398.
1 parent 0ceaa70 commit c2b7335

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/NHibernate/Dialect/PostgreSQLDialect.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,21 @@ public PostgreSQLDialect()
6464
RegisterFunction("replace", new StandardSQLFunction("replace", NHibernateUtil.String));
6565
RegisterFunction("left", new SQLFunctionTemplate(NHibernateUtil.String, "substr(?1,1,?2)"));
6666
RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "((?1) % (?2))"));
67+
68+
RegisterFunction("sign", new StandardSQLFunction("sign", NHibernateUtil.Int32));
69+
RegisterFunction("round", new SQLFunctionTemplate(NHibernateUtil.Double, "round(cast(?1 as numeric), ?2)"));
70+
71+
// Trigonometric functions.
72+
RegisterFunction("acos", new StandardSQLFunction("acos", NHibernateUtil.Double));
73+
RegisterFunction("asin", new StandardSQLFunction("asin", NHibernateUtil.Double));
74+
RegisterFunction("atan", new StandardSQLFunction("atan", NHibernateUtil.Double));
75+
RegisterFunction("cos", new StandardSQLFunction("cos", NHibernateUtil.Double));
76+
RegisterFunction("cot", new StandardSQLFunction("cot", NHibernateUtil.Double));
77+
RegisterFunction("sin", new StandardSQLFunction("sin", NHibernateUtil.Double));
78+
RegisterFunction("tan", new StandardSQLFunction("tan", NHibernateUtil.Double));
79+
RegisterFunction("atan2", new StandardSQLFunction("atan2", NHibernateUtil.Double));
80+
81+
RegisterFunction("power", new StandardSQLFunction("power", NHibernateUtil.Double));
6782
}
6883

6984
public override string AddColumnString

0 commit comments

Comments
 (0)