From: <fab...@us...> - 2008-12-16 04:26:13
|
Revision: 3955 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3955&view=rev Author: fabiomaulo Date: 2008-12-16 04:26:06 +0000 (Tue, 16 Dec 2008) Log Message: ----------- Fix NH-1595 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2008-12-15 23:37:40 UTC (rev 3954) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2008-12-16 04:26:06 UTC (rev 3955) @@ -1,5 +1,6 @@ using System.Data; using System.Text; +using NHibernate.Dialect.Function; using NHibernate.SqlCommand; using NHibernate.Util; using System.Data.Common; @@ -44,6 +45,13 @@ RegisterColumnType(DbType.Time, "DATETIME"); RegisterColumnType(DbType.Boolean, "INTEGER"); RegisterColumnType(DbType.Guid, "UNIQUEIDENTIFIER"); + + RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%S\", ?1)")); + RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%M\", ?1)")); + RegisterFunction("hour", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%H\", ?1)")); + RegisterFunction("day", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%d\", ?1)")); + RegisterFunction("month", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%m\", ?1)")); + RegisterFunction("year", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%Y\", ?1)")); } public override Schema.IDataBaseSchema GetDataBaseSchema(DbConnection connection) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-03 04:21:18
|
Revision: 4016 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4016&view=rev Author: fabiomaulo Date: 2009-02-03 04:21:15 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Fix NH-1582 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2009-02-03 03:50:06 UTC (rev 4015) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2009-02-03 04:21:15 UTC (rev 4016) @@ -41,6 +41,7 @@ RegisterColumnType(DbType.AnsiStringFixedLength, "TEXT"); RegisterColumnType(DbType.StringFixedLength, "TEXT"); + RegisterColumnType(DbType.Date, "DATETIME"); RegisterColumnType(DbType.DateTime, "DATETIME"); RegisterColumnType(DbType.Time, "DATETIME"); RegisterColumnType(DbType.Boolean, "INTEGER"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-10-14 20:38:40
|
Revision: 4750 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4750&view=rev Author: fabiomaulo Date: 2009-10-14 20:38:28 +0000 (Wed, 14 Oct 2009) Log Message: ----------- Merge r4749 (fix NH-1970) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2009-10-14 20:37:46 UTC (rev 4749) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2009-10-14 20:38:28 UTC (rev 4750) @@ -53,6 +53,7 @@ RegisterFunction("day", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%d\", ?1)")); RegisterFunction("month", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%m\", ?1)")); RegisterFunction("year", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%Y\", ?1)")); + RegisterFunction("substring", new StandardSQLFunction("substr", NHibernateUtil.String)); } public override Schema.IDataBaseSchema GetDataBaseSchema(DbConnection connection) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2010-08-07 17:35:42
|
Revision: 5126 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5126&view=rev Author: fabiomaulo Date: 2010-08-07 17:35:36 +0000 (Sat, 07 Aug 2010) Log Message: ----------- Fix NH-2220 (by Thomas Hotz) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2010-08-07 17:24:50 UTC (rev 5125) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2010-08-07 17:35:36 UTC (rev 5126) @@ -219,5 +219,20 @@ return pagingBuilder.ToSqlString(); } + + public override bool SupportsTemporaryTables + { + get { return true; } + } + + public override string CreateTemporaryTableString + { + get { return "create temp table"; } + } + + public override bool DropTemporaryTableAfterUse() + { + return true; + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jul...@us...> - 2010-08-11 14:37:11
|
Revision: 5138 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5138&view=rev Author: julian-maughan Date: 2010-08-11 14:37:05 +0000 (Wed, 11 Aug 2010) Log Message: ----------- Corrected the return type for 'strftime' SQLFunctionTemplate (NH-2224) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2010-08-11 13:27:05 UTC (rev 5137) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2010-08-11 14:37:05 UTC (rev 5138) @@ -47,12 +47,12 @@ RegisterColumnType(DbType.Boolean, "INTEGER"); RegisterColumnType(DbType.Guid, "UNIQUEIDENTIFIER"); - RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%S\", ?1)")); - RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%M\", ?1)")); - RegisterFunction("hour", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%H\", ?1)")); - RegisterFunction("day", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%d\", ?1)")); - RegisterFunction("month", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%m\", ?1)")); - RegisterFunction("year", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%Y\", ?1)")); + RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.String, "strftime(\"%S\", ?1)")); + RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.String, "strftime(\"%M\", ?1)")); + RegisterFunction("hour", new SQLFunctionTemplate(NHibernateUtil.String, "strftime(\"%H\", ?1)")); + 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)")); RegisterFunction("substring", new StandardSQLFunction("substr", NHibernateUtil.String)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-06 03:59:51
|
Revision: 5430 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5430&view=rev Author: patearl Date: 2011-03-06 03:59:45 +0000 (Sun, 06 Mar 2011) Log Message: ----------- SQLite: Added trim emulation function. SQLite: Improved quoting on date extraction functions. 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 03:58:22 UTC (rev 5429) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-06 03:59:45 UTC (rev 5430) @@ -47,13 +47,14 @@ RegisterColumnType(DbType.Boolean, "INTEGER"); RegisterColumnType(DbType.Guid, "UNIQUEIDENTIFIER"); - RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.String, "strftime(\"%S\", ?1)")); - RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.String, "strftime(\"%M\", ?1)")); - RegisterFunction("hour", new SQLFunctionTemplate(NHibernateUtil.String, "strftime(\"%H\", ?1)")); - 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)")); + RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.String, "strftime('%S', ?1)")); + RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.String, "strftime('%M', ?1)")); + RegisterFunction("hour", new SQLFunctionTemplate(NHibernateUtil.String, "strftime('%H', ?1)")); + 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)")); RegisterFunction("substring", new StandardSQLFunction("substr", NHibernateUtil.String)); + RegisterFunction("trim", new AnsiTrimEmulationFunction()); } public override Schema.IDataBaseSchema GetDataBaseSchema(DbConnection connection) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-06 07:17:10
|
Revision: 5435 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5435&view=rev Author: patearl Date: 2011-03-06 07:17:04 +0000 (Sun, 06 Mar 2011) Log Message: ----------- SQLite: Support for current_timestamp() function. Returns UTC with SQLite. 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 06:53:56 UTC (rev 5434) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-06 07:17:04 UTC (rev 5435) @@ -53,6 +53,7 @@ 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)")); + RegisterFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", NHibernateUtil.DateTime, false)); 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. |
From: <pa...@us...> - 2011-03-06 16:29:36
|
Revision: 5436 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5436&view=rev Author: patearl Date: 2011-03-06 16:29:29 +0000 (Sun, 06 Mar 2011) Log Message: ----------- SQLite: Change current_timestamp to return local time like other DBs. 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 07:17:04 UTC (rev 5435) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-06 16:29:29 UTC (rev 5436) @@ -53,7 +53,10 @@ 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)")); - RegisterFunction("current_timestamp", new NoArgSQLFunction("current_timestamp", NHibernateUtil.DateTime, false)); + + // 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()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-06 21:22:40
|
Revision: 5441 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5441&view=rev Author: patearl Date: 2011-03-06 21:22:34 +0000 (Sun, 06 Mar 2011) Log Message: ----------- SQLite: Fixed guid generation 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 21:13:30 UTC (rev 5440) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-06 21:22:34 UTC (rev 5441) @@ -245,7 +245,7 @@ public override string SelectGUIDString { - get { return "randomblob(16)"; } + get { return "select 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. |
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. |
From: <pa...@us...> - 2011-03-09 04:20:19
|
Revision: 5446 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5446&view=rev Author: patearl Date: 2011-03-09 04:20:13 +0000 (Wed, 09 Mar 2011) Log Message: ----------- SQLite: Avoid the problematic cast 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-09 03:42:40 UTC (rev 5445) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-09 04:20:13 UTC (rev 5446) @@ -67,6 +67,13 @@ RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "((?1) % (?2))")); RegisterFunction("iif", new SQLFunctionTemplate(null, "case when ?1 then ?2 else ?3 end")); + + // Casting in SQLite is unnecessary since SQLite is essentially typeless. + // String operators can be performed on integers, integer ops on strings, etc. + // For some reason, doing cast('2001-02-03 04:05:06' as datetime) returns 2001. + // In fact, casting to even a type named as a string of garbage returns the same thing. + // Therefore, it's better to avoid the cast function entirely. + RegisterFunction("cast", new SQLFunctionTemplate(null, "(?1)")); } public override Schema.IDataBaseSchema GetDataBaseSchema(DbConnection connection) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-13 03:13:40
|
Revision: 5462 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5462&view=rev Author: patearl Date: 2011-03-13 03:13:34 +0000 (Sun, 13 Mar 2011) Log Message: ----------- SQLite: Marked embedded function class as serializable. 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-13 03:09:26 UTC (rev 5461) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-13 03:13:34 UTC (rev 5462) @@ -1,3 +1,4 @@ +using System; using System.Data; using System.Data.Common; using System.Text; @@ -255,6 +256,7 @@ get { return "select randomblob(16)"; } } + [Serializable] protected class SQLiteCastFunction : CastFunction { protected override bool CastingIsRequired(string sqlType) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-22 05:14:42
|
Revision: 5499 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5499&view=rev Author: patearl Date: 2011-03-22 05:14:35 +0000 (Tue, 22 Mar 2011) Log Message: ----------- SQLite: Made year, month, day, hour, minute, and second functions return integers instead of zero padded strings. 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-21 21:27:07 UTC (rev 5498) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-22 05:14:35 UTC (rev 5499) @@ -48,12 +48,13 @@ RegisterColumnType(DbType.Boolean, "INTEGER"); RegisterColumnType(DbType.Guid, "UNIQUEIDENTIFIER"); - RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.String, "strftime('%S', ?1)")); - RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.String, "strftime('%M', ?1)")); - RegisterFunction("hour", new SQLFunctionTemplate(NHibernateUtil.String, "strftime('%H', ?1)")); - 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)")); + // Using strftime returns 0-padded strings. '07' <> 7, so it is better to convert to an integer. + RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%S', ?1) as int)")); + RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%M', ?1) as int)")); + RegisterFunction("hour", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%H', ?1) as int)")); + RegisterFunction("day", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%d', ?1) as int)")); + RegisterFunction("month", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%m', ?1) as int)")); + RegisterFunction("year", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%Y', ?1) as int)")); // 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' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-22 23:02:15
|
Revision: 5506 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5506&view=rev Author: patearl Date: 2011-03-22 23:02:09 +0000 (Tue, 22 Mar 2011) Log Message: ----------- SQLite: Register the int keyword so the sql formula parser doesn't munge it in our date cast expressions. 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-22 20:33:16 UTC (rev 5505) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-22 23:02:09 UTC (rev 5506) @@ -72,6 +72,9 @@ RegisterFunction("iif", new SQLFunctionTemplate(null, "case when ?1 then ?2 else ?3 end")); RegisterFunction("cast", new SQLiteCastFunction()); + + + RegisterKeyword("int"); // Used in our function templates. } public override Schema.IDataBaseSchema GetDataBaseSchema(DbConnection connection) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-24 02:50:06
|
Revision: 5515 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5515&view=rev Author: patearl Date: 2011-03-24 02:50:00 +0000 (Thu, 24 Mar 2011) Log Message: ----------- Improved SQLite type mapping to match the System.Data.SQLite provider, which is by far the dominant provider. 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-23 21:48:51 UTC (rev 5514) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-24 02:50:00 UTC (rev 5515) @@ -24,28 +24,28 @@ public SQLiteDialect() { RegisterColumnType(DbType.Binary, "BLOB"); - RegisterColumnType(DbType.Byte, "INTEGER"); - RegisterColumnType(DbType.Int16, "INTEGER"); - RegisterColumnType(DbType.Int32, "INTEGER"); - RegisterColumnType(DbType.Int64, "INTEGER"); + RegisterColumnType(DbType.Byte, "TINYINT"); + RegisterColumnType(DbType.Int16, "SMALLINT"); + RegisterColumnType(DbType.Int32, "INT"); + RegisterColumnType(DbType.Int64, "BIGINT"); RegisterColumnType(DbType.SByte, "INTEGER"); RegisterColumnType(DbType.UInt16, "INTEGER"); RegisterColumnType(DbType.UInt32, "INTEGER"); RegisterColumnType(DbType.UInt64, "INTEGER"); RegisterColumnType(DbType.Currency, "NUMERIC"); RegisterColumnType(DbType.Decimal, "NUMERIC"); - RegisterColumnType(DbType.Double, "NUMERIC"); - RegisterColumnType(DbType.Single, "NUMERIC"); + RegisterColumnType(DbType.Double, "DOUBLE"); + RegisterColumnType(DbType.Single, "DOUBLE"); RegisterColumnType(DbType.VarNumeric, "NUMERIC"); RegisterColumnType(DbType.AnsiString, "TEXT"); RegisterColumnType(DbType.String, "TEXT"); RegisterColumnType(DbType.AnsiStringFixedLength, "TEXT"); RegisterColumnType(DbType.StringFixedLength, "TEXT"); - RegisterColumnType(DbType.Date, "DATETIME"); + RegisterColumnType(DbType.Date, "DATE"); RegisterColumnType(DbType.DateTime, "DATETIME"); - RegisterColumnType(DbType.Time, "DATETIME"); - RegisterColumnType(DbType.Boolean, "INTEGER"); + RegisterColumnType(DbType.Time, "TIME"); + RegisterColumnType(DbType.Boolean, "BOOL"); RegisterColumnType(DbType.Guid, "UNIQUEIDENTIFIER"); // Using strftime returns 0-padded strings. '07' <> 7, so it is better to convert to an integer. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-27 05:22:04
|
Revision: 5549 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5549&view=rev Author: patearl Date: 2011-03-27 05:21:58 +0000 (Sun, 27 Mar 2011) Log Message: ----------- SQLite: Added default properties for query substitutions and driver. 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-27 05:10:59 UTC (rev 5548) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-27 05:21:58 UTC (rev 5549) @@ -77,6 +77,12 @@ RegisterKeyword("int"); // Used in our function templates. } + protected virtual void RegisterDefaultProperties() + { + DefaultProperties[Cfg.Environment.ConnectionDriver] = "NHibernate.Driver.SQLite20Driver"; + DefaultProperties[Cfg.Environment.QuerySubstitutions] = "true 1, false 0, yes 'Y', no 'N'"; + } + public override Schema.IDataBaseSchema GetDataBaseSchema(DbConnection connection) { return new Schema.SQLiteDataBaseMetaData(connection); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-27 05:31:30
|
Revision: 5551 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5551&view=rev Author: patearl Date: 2011-03-27 05:31:22 +0000 (Sun, 27 Mar 2011) Log Message: ----------- SQLite: Fixed default property registration and organized registration functions. 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-27 05:23:58 UTC (rev 5550) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-27 05:31:22 UTC (rev 5551) @@ -23,59 +23,72 @@ /// </summary> public SQLiteDialect() { - RegisterColumnType(DbType.Binary, "BLOB"); + RegisterColumnTypes(); + RegisterFunctions(); + RegisterKeywords(); + RegisterDefaultProperties(); + } + + protected virtual void RegisterColumnTypes() + { + RegisterColumnType(DbType.Binary, "BLOB"); RegisterColumnType(DbType.Byte, "TINYINT"); RegisterColumnType(DbType.Int16, "SMALLINT"); - RegisterColumnType(DbType.Int32, "INT"); - RegisterColumnType(DbType.Int64, "BIGINT"); - RegisterColumnType(DbType.SByte, "INTEGER"); - RegisterColumnType(DbType.UInt16, "INTEGER"); - RegisterColumnType(DbType.UInt32, "INTEGER"); - RegisterColumnType(DbType.UInt64, "INTEGER"); - RegisterColumnType(DbType.Currency, "NUMERIC"); - RegisterColumnType(DbType.Decimal, "NUMERIC"); - RegisterColumnType(DbType.Double, "DOUBLE"); - RegisterColumnType(DbType.Single, "DOUBLE"); - RegisterColumnType(DbType.VarNumeric, "NUMERIC"); - RegisterColumnType(DbType.AnsiString, "TEXT"); - RegisterColumnType(DbType.String, "TEXT"); - RegisterColumnType(DbType.AnsiStringFixedLength, "TEXT"); - RegisterColumnType(DbType.StringFixedLength, "TEXT"); + RegisterColumnType(DbType.Int32, "INT"); + RegisterColumnType(DbType.Int64, "BIGINT"); + RegisterColumnType(DbType.SByte, "INTEGER"); + RegisterColumnType(DbType.UInt16, "INTEGER"); + RegisterColumnType(DbType.UInt32, "INTEGER"); + RegisterColumnType(DbType.UInt64, "INTEGER"); + RegisterColumnType(DbType.Currency, "NUMERIC"); + RegisterColumnType(DbType.Decimal, "NUMERIC"); + RegisterColumnType(DbType.Double, "DOUBLE"); + RegisterColumnType(DbType.Single, "DOUBLE"); + RegisterColumnType(DbType.VarNumeric, "NUMERIC"); + RegisterColumnType(DbType.AnsiString, "TEXT"); + RegisterColumnType(DbType.String, "TEXT"); + RegisterColumnType(DbType.AnsiStringFixedLength, "TEXT"); + RegisterColumnType(DbType.StringFixedLength, "TEXT"); - RegisterColumnType(DbType.Date, "DATE"); - RegisterColumnType(DbType.DateTime, "DATETIME"); - RegisterColumnType(DbType.Time, "TIME"); - RegisterColumnType(DbType.Boolean, "BOOL"); - RegisterColumnType(DbType.Guid, "UNIQUEIDENTIFIER"); + RegisterColumnType(DbType.Date, "DATE"); + RegisterColumnType(DbType.DateTime, "DATETIME"); + RegisterColumnType(DbType.Time, "TIME"); + RegisterColumnType(DbType.Boolean, "BOOL"); + RegisterColumnType(DbType.Guid, "UNIQUEIDENTIFIER"); + } + protected virtual void RegisterFunctions() + { // Using strftime returns 0-padded strings. '07' <> 7, so it is better to convert to an integer. - RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%S', ?1) as int)")); + RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%S', ?1) as int)")); RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%M', ?1) as int)")); RegisterFunction("hour", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%H', ?1) as int)")); RegisterFunction("day", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%d', ?1) as int)")); RegisterFunction("month", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%m', ?1) as int)")); RegisterFunction("year", new SQLFunctionTemplate(NHibernateUtil.Int32, "cast(strftime('%Y', ?1) as int)")); - // 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))")); + // 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("left", new SQLFunctionTemplate(NHibernateUtil.String, "substr(?1,1,?2)")); - RegisterFunction("trim", new AnsiTrimEmulationFunction()); + RegisterFunction("substring", new StandardSQLFunction("substr", NHibernateUtil.String)); + RegisterFunction("left", new SQLFunctionTemplate(NHibernateUtil.String, "substr(?1,1,?2)")); + RegisterFunction("trim", new AnsiTrimEmulationFunction()); - RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "((?1) % (?2))")); + RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "((?1) % (?2))")); - RegisterFunction("iif", new SQLFunctionTemplate(null, "case when ?1 then ?2 else ?3 end")); + RegisterFunction("iif", new SQLFunctionTemplate(null, "case when ?1 then ?2 else ?3 end")); - RegisterFunction("cast", new SQLiteCastFunction()); + RegisterFunction("cast", new SQLiteCastFunction()); + } - + protected virtual void RegisterKeywords() + { RegisterKeyword("int"); // Used in our function templates. - } + } protected virtual void RegisterDefaultProperties() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |