From: <pa...@us...> - 2011-03-07 06:03:50
|
Revision: 5443 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5443&view=rev Author: patearl Date: 2011-03-07 06:03:44 +0000 (Mon, 07 Mar 2011) Log Message: ----------- SQLite: Use a more successful datetime string for the date() function. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-06 22:46:09 UTC (rev 5442) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-07 06:03:44 UTC (rev 5443) @@ -55,6 +55,11 @@ RegisterFunction("year", new SQLFunctionTemplate(NHibernateUtil.String, "strftime('%Y', ?1)")); // Uses local time like MSSQL and PostgreSQL. RegisterFunction("current_timestamp", new SQLFunctionTemplate(NHibernateUtil.DateTime, "datetime(current_timestamp, 'localtime')")); + // The System.Data.SQLite driver stores both Date and DateTime as 'YYYY-MM-DD HH:MM:SS' + // The SQLite date() function returns YYYY-MM-DD, which unfortunately SQLite does not consider + // as equal to 'YYYY-MM-DD 00:00:00'. Because of this, it is best to return the + // 'YYYY-MM-DD 00:00:00' format for the date function. + RegisterFunction("date", new SQLFunctionTemplate(NHibernateUtil.Date, "datetime(date(?1))")); RegisterFunction("substring", new StandardSQLFunction("substr", NHibernateUtil.String)); RegisterFunction("trim", new AnsiTrimEmulationFunction()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |