From: <dar...@us...> - 2009-02-05 13:24:16
|
Revision: 4052 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4052&view=rev Author: darioquintana Date: 2009-02-05 13:24:13 +0000 (Thu, 05 Feb 2009) Log Message: ----------- NH-1659: current_timestamp in MsSql2008Dialect using SYSDATETIME() NH-1658: current_timestamp_offset: current_timestamp for DateTimeOffset Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/MsSql2008Dialect.cs trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2008Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/MsSql2008Dialect.cs 2009-02-05 12:06:08 UTC (rev 4051) +++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2008Dialect.cs 2009-02-05 13:24:13 UTC (rev 4052) @@ -1,4 +1,5 @@ using System.Data; +using NHibernate.Dialect.Function; namespace NHibernate.Dialect { @@ -10,6 +11,9 @@ RegisterColumnType(DbType.DateTimeOffset, "DATETIMEOFFSET"); RegisterColumnType(DbType.Date, "DATE"); //RegisterColumnType(DbType.Time, "TIME"); + + RegisterFunction("current_timestamp", new NoArgSQLFunction("sysdatetime", NHibernateUtil.DateTime2, true)); + RegisterFunction("current_timestamp_offset", new NoArgSQLFunction("sysdatetimeoffset", NHibernateUtil.DateTimeOffset, true)); } } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-02-05 12:06:08 UTC (rev 4051) +++ trunk/nhibernate/src/NHibernate.Test/HQL/HQLFunctions.cs 2009-02-05 13:24:13 UTC (rev 4052) @@ -744,7 +744,27 @@ } } + /// <summary> + /// NH-1658 + /// </summary> [Test] + public void Current_TimeStamp_Offset() + { + IgnoreIfNotSupported("current_timestamp_offset"); + using (ISession s = OpenSession()) + { + Animal a1 = new Animal("abcdef", 1.3f); + s.Save(a1); + s.Flush(); + } + using (ISession s = OpenSession()) + { + string hql = "select current_timestamp_offset() from Animal"; + IList result = s.CreateQuery(hql).List(); + } + } + + [Test] public void Extract() { IgnoreIfNotSupported("extract"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |