From: <pa...@us...> - 2011-03-06 20:04:03
|
Revision: 5437 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5437&view=rev Author: patearl Date: 2011-03-06 20:03:56 +0000 (Sun, 06 Mar 2011) Log Message: ----------- Support "mod" function for PostgreSQL and SQLite. Support GUID generation for SQLite. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs 2011-03-06 16:29:29 UTC (rev 5436) +++ trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs 2011-03-06 20:03:56 UTC (rev 5437) @@ -67,6 +67,8 @@ RegisterFunction("substring", new AnsiSubstringFunction()); RegisterFunction("replace", new StandardSQLFunction("replace", NHibernateUtil.String)); + RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "((?1) % (?2))")); + DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.NpgsqlDriver"; } Modified: trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-06 16:29:29 UTC (rev 5436) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-06 20:03:56 UTC (rev 5437) @@ -53,12 +53,13 @@ RegisterFunction("day", new SQLFunctionTemplate(NHibernateUtil.String, "strftime('%d', ?1)")); RegisterFunction("month", new SQLFunctionTemplate(NHibernateUtil.String, "strftime('%m', ?1)")); 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')")); RegisterFunction("substring", new StandardSQLFunction("substr", NHibernateUtil.String)); RegisterFunction("trim", new AnsiTrimEmulationFunction()); + + RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "((?1) % (?2))")); } public override Schema.IDataBaseSchema GetDataBaseSchema(DbConnection connection) @@ -239,5 +240,10 @@ { return true; } + + public override string SelectGUIDString + { + get { return "randomblob(16)"; } + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |