You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <fab...@us...> - 2009-02-04 22:15:25
|
Revision: 4045 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4045&view=rev Author: fabiomaulo Date: 2009-02-04 22:15:23 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Fix NH-1479 (new feature guid.native generator) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs trunk/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate/Id/NativeGuidGenerator.cs trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/ trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidFixture.cs trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidGeneratorFixture.cs trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidPoid.cs trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidPoid.hbm.xml Modified: trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2009-02-04 21:49:37 UTC (rev 4044) +++ trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2009-02-04 22:15:23 UTC (rev 4045) @@ -271,7 +271,7 @@ /// <returns> The appropriate command. </returns> public virtual string SelectGUIDString { - get{throw new NotSupportedException("dialect does not support GUIDs");} + get{throw new NotSupportedException("dialect does not support server side GUIDs generation.");} } /// <summary> Command used to create a table. </summary> Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2009-02-04 21:49:37 UTC (rev 4044) +++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2009-02-04 22:15:23 UTC (rev 4045) @@ -159,6 +159,11 @@ get { return false; } } + public override string SelectGUIDString + { + get { return "select newid()"; } + } + /// <summary> /// Generates the string to drop the table using SQL Server syntax. /// </summary> Modified: trunk/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs 2009-02-04 21:49:37 UTC (rev 4044) +++ trunk/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs 2009-02-04 22:15:23 UTC (rev 4045) @@ -40,6 +40,10 @@ /// <description><see cref="GuidCombGenerator"/></description> /// </item> /// <item> + /// <term>guid.native</term> + /// <description><see cref="NativeGuidGenerator"/></description> + /// </item> + /// <item> /// <term>hilo</term> /// <description><see cref="TableHiLoGenerator"/></description> /// </item> @@ -165,6 +169,7 @@ idgenerators.Add("foreign", typeof(ForeignGenerator)); idgenerators.Add("guid", typeof(GuidGenerator)); idgenerators.Add("guid.comb", typeof(GuidCombGenerator)); + idgenerators.Add("guid.native", typeof(NativeGuidGenerator)); idgenerators.Add("select", typeof(SelectGenerator)); } Added: trunk/nhibernate/src/NHibernate/Id/NativeGuidGenerator.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Id/NativeGuidGenerator.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Id/NativeGuidGenerator.cs 2009-02-04 22:15:23 UTC (rev 4045) @@ -0,0 +1,58 @@ +using System; +using System.Data; +using log4net; +using NHibernate.Engine; +using NHibernate.Exceptions; +using NHibernate.SqlCommand; +using NHibernate.SqlTypes; +using NHibernate.Type; + +namespace NHibernate.Id +{ + /// <summary> + /// Generates Guid values using the server side Guid function. + /// </summary> + public class NativeGuidGenerator : IIdentifierGenerator + { + private static readonly ILog log = LogManager.GetLogger(typeof(NativeGuidGenerator)); + private readonly IType identifierType = new GuidType(); + + #region Implementation of IIdentifierGenerator + + public object Generate(ISessionImplementor session, object obj) + { + var sql = new SqlString(session.Factory.Dialect.SelectGUIDString); + try + { + IDbCommand st = session.Batcher.PrepareCommand(CommandType.Text, sql, SqlTypeFactory.NoTypes); + IDataReader reader = null; + try + { + reader = session.Batcher.ExecuteReader(st); + object result; + try + { + reader.Read(); + result = IdentifierGeneratorFactory.Get(reader, identifierType, session); + } + finally + { + reader.Close(); + } + log.Debug("GUID identifier generated: " + result); + return result; + } + finally + { + session.Batcher.CloseCommand(st, reader); + } + } + catch (Exception sqle) + { + throw ADOExceptionHelper.Convert(session.Factory.SQLExceptionConverter, sqle, "could not retrieve GUID", sql); + } + } + + #endregion + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-02-04 21:49:37 UTC (rev 4044) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-02-04 22:15:23 UTC (rev 4045) @@ -464,6 +464,7 @@ <Compile Include="Exceptions\ReflectionBasedSqlStateExtracter.cs" /> <Compile Include="Exceptions\SqlStateExtracter.cs" /> <Compile Include="Exceptions\TemplatedViolatedConstraintNameExtracter.cs" /> + <Compile Include="Id\NativeGuidGenerator.cs" /> <Compile Include="Id\SelectGenerator.cs" /> <Compile Include="IFutureValue.cs" /> <Compile Include="Impl\DelayedEnumerator.cs" /> Added: trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidFixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidFixture.cs 2009-02-04 22:15:23 UTC (rev 4045) @@ -0,0 +1,44 @@ +using System.Collections; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; + +namespace NHibernate.Test.IdGen.NativeGuid +{ + [TestFixture] + public class NativeGuidFixture : TestCase + { + protected override string MappingsAssembly + { + get { return "NHibernate.Test"; } + } + + protected override IList Mappings + { + get { return new[] {"IdGen.NativeGuid.NativeGuidPoid.hbm.xml"}; } + } + + [Test] + public void Crd() + { + object savedId; + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + var nativeGuidPoid = new NativeGuidPoid(); + savedId = s.Save(nativeGuidPoid); + tx.Commit(); + Assert.That(savedId, Is.Not.Null); + Assert.That(savedId, Is.EqualTo(nativeGuidPoid.Id)); + } + + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + var nativeGuidPoid = s.Get<NativeGuidPoid>(savedId); + Assert.That(nativeGuidPoid, Is.Not.Null); + s.Delete(nativeGuidPoid); + tx.Commit(); + } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidGeneratorFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidGeneratorFixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidGeneratorFixture.cs 2009-02-04 22:15:23 UTC (rev 4045) @@ -0,0 +1,47 @@ +using System; +using NHibernate.Cfg; +using NHibernate.Engine; +using NHibernate.Id; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; + +namespace NHibernate.Test.IdGen.NativeGuid +{ + [TestFixture] + public class NativeGuidGeneratorFixture + { + protected Configuration cfg; + protected ISessionFactoryImplementor sessions; + + [TestFixtureSetUp] + public void TestFixtureSetUp() + { + cfg = new Configuration(); + if (TestConfigurationHelper.hibernateConfigFile != null) + cfg.Configure(TestConfigurationHelper.hibernateConfigFile); + + sessions = (ISessionFactoryImplementor) cfg.BuildSessionFactory(); + } + + [Test] + public void ReturnedValueIsGuid() + { + try + { + var str = Dialect.Dialect.GetDialect().SelectGUIDString; + } + catch (NotSupportedException) + { + Assert.Ignore("This test does not apply to {0}", Dialect.Dialect.GetDialect()); + } + + var gen = new NativeGuidGenerator(); + using (ISession s = sessions.OpenSession()) + { + object result = gen.Generate((ISessionImplementor)s, null); + Assert.That(result, Is.TypeOf(typeof (Guid))); + Assert.That(result, Is.Not.EqualTo(Guid.Empty)); + } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidPoid.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidPoid.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidPoid.cs 2009-02-04 22:15:23 UTC (rev 4045) @@ -0,0 +1,9 @@ +using System; + +namespace NHibernate.Test.IdGen.NativeGuid +{ + public class NativeGuidPoid + { + public Guid Id { get; set; } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidPoid.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidPoid.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/IdGen/NativeGuid/NativeGuidPoid.hbm.xml 2009-02-04 22:15:23 UTC (rev 4045) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.IdGen.NativeGuid" + default-lazy="false"> + + <class name="NativeGuidPoid"> + <id name="Id"> + <generator class="guid.native" /> + </id> + </class> + +</hibernate-mapping> Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-02-04 21:49:37 UTC (rev 4044) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-02-04 22:15:23 UTC (rev 4045) @@ -294,6 +294,9 @@ <Compile Include="BulkManipulation\Vehicles.cs" /> <Compile Include="HQL\HqlFixture.cs" /> <Compile Include="IdGen\Enhanced\SequenceStyleConfigUnitFixture.cs" /> + <Compile Include="IdGen\NativeGuid\NativeGuidFixture.cs" /> + <Compile Include="IdGen\NativeGuid\NativeGuidGeneratorFixture.cs" /> + <Compile Include="IdGen\NativeGuid\NativeGuidPoid.cs" /> <Compile Include="IdTest\Car.cs" /> <Compile Include="IdTest\HiLoInt16Class.cs" /> <Compile Include="IdTest\HiLoInt32Class.cs" /> @@ -1622,6 +1625,7 @@ <EmbeddedResource Include="Cascade\JobBatch.hbm.xml" /> <EmbeddedResource Include="Deletetransient\Person.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="IdGen\NativeGuid\NativeGuidPoid.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\Dates\Mappings\DateTimeOffset.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1654\Mappings.hbm.xml" /> <EmbeddedResource Include="Pagination\DataPoint.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-04 20:49:40
|
Revision: 4043 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4043&view=rev Author: fabiomaulo Date: 2009-02-04 20:49:36 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Ensure 'returnColumnName' variable is a valid alias. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/SqlCommand/DecodeCaseFragment.cs Modified: trunk/nhibernate/src/NHibernate/SqlCommand/DecodeCaseFragment.cs =================================================================== --- trunk/nhibernate/src/NHibernate/SqlCommand/DecodeCaseFragment.cs 2009-02-04 20:16:20 UTC (rev 4042) +++ trunk/nhibernate/src/NHibernate/SqlCommand/DecodeCaseFragment.cs 2009-02-04 20:49:36 UTC (rev 4043) @@ -38,7 +38,7 @@ } buf.Append(StringHelper.ClosedParen); - if (returnColumnName != null) + if (!string.IsNullOrEmpty(returnColumnName)) { buf.Append(" as ").Append(returnColumnName); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-04 20:16:22
|
Revision: 4042 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4042&view=rev Author: fabiomaulo Date: 2009-02-04 20:16:20 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Minor Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH364/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH364/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH364/Fixture.cs 2009-02-04 20:10:30 UTC (rev 4041) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH364/Fixture.cs 2009-02-04 20:16:20 UTC (rev 4042) @@ -90,7 +90,7 @@ using (ISession s = OpenSession()) { Invoice invToUpdate = s.Get<Invoice>(inv.Id); - ((InvoiceItem)invToUpdate.Items[0]).Quantity = 10; // update information of an element + ((InvoiceItem)invToUpdate.Items[0]).Quantity = 10m; // update information of an element invToUpdate.Items.Add(new InvoiceItem(product3, 1)); // update the idbag collection s.Flush(); s.Clear(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-04 20:10:32
|
Revision: 4041 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4041&view=rev Author: fabiomaulo Date: 2009-02-04 20:10:30 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Fixed OracleMetaData for SchemaUpdate and SchemaValidation Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/Schema/OracleMetaData.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/Schema/OracleMetaData.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Schema/OracleMetaData.cs 2009-02-04 17:52:02 UTC (rev 4040) +++ trunk/nhibernate/src/NHibernate/Dialect/Schema/OracleMetaData.cs 2009-02-04 20:10:30 UTC (rev 4041) @@ -12,6 +12,46 @@ { return new OracleTableMetadata(rs, this, extras); } + + public override bool StoresUpperCaseIdentifiers + { + get { return true; } + } + + public override DataTable GetTables(string catalog, string schemaPattern, string tableNamePattern, string[] types) + { + string owner = string.IsNullOrEmpty(schemaPattern) ? null : schemaPattern; + var restrictions = new[] { owner, tableNamePattern }; + return Connection.GetSchema("Tables", restrictions); + } + + public override DataTable GetColumns(string catalog, string schemaPattern, string tableNamePattern, string columnNamePattern) + { + string owner = string.IsNullOrEmpty(schemaPattern) ? null : schemaPattern; + var restrictions = new[] { owner, tableNamePattern, columnNamePattern }; + return Connection.GetSchema("Columns", restrictions); + } + + public override DataTable GetIndexColumns(string catalog, string schemaPattern, string tableName, string indexName) + { + string owner = string.IsNullOrEmpty(schemaPattern) ? null : schemaPattern; + var restrictions = new[] { owner, indexName, null, tableName, null }; + return Connection.GetSchema("IndexColumns", restrictions); + } + + public override DataTable GetIndexInfo(string catalog, string schemaPattern, string tableName) + { + string owner = string.IsNullOrEmpty(schemaPattern) ? null : schemaPattern; + var restrictions = new[] { owner, null, null, tableName }; + return Connection.GetSchema("Indexes", restrictions); + } + + public override DataTable GetForeignKeys(string catalog, string schema, string table) + { + string owner = string.IsNullOrEmpty(schema) ? null : schema; + var restrictions = new[] { owner, table, null }; + return Connection.GetSchema("ForeignKeys", restrictions); + } } public class OracleTableMetadata : AbstractTableMetadata @@ -28,7 +68,7 @@ protected override string GetConstraintName(DataRow rs) { - return Convert.ToString(rs["FOREIGN_KEY_CONSTRIANT_NAME"]); + return Convert.ToString(rs["FOREIGN_KEY_CONSTRAINT_NAME"]); } protected override string GetColumnName(DataRow rs) @@ -92,7 +132,7 @@ public OracleForeignKeyMetadata(DataRow rs) : base(rs) { - Name = Convert.ToString(rs["FOREIGN_KEY_CONSTRIANT_NAME"]); + Name = Convert.ToString(rs["FOREIGN_KEY_CONSTRAINT_NAME"]); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-04 17:52:06
|
Revision: 4040 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4040&view=rev Author: fabiomaulo Date: 2009-02-04 17:52:02 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Minor (changed formula to work with Oracle as well) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Mappings.hbm.xml Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Mappings.hbm.xml 2009-02-04 17:27:51 UTC (rev 4039) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Mappings.hbm.xml 2009-02-04 17:52:02 UTC (rev 4040) @@ -10,7 +10,7 @@ <property name="Name" type="String" length="30"/> <property name="Type" type="String" length="30"/> <property name ="CompanyCount" - formula="(SELECT COUNT(*) FROM services as c WHERE c.accountNumber LIKE '63%' )" + formula="(SELECT COUNT(*) FROM services c WHERE c.accountNumber LIKE '63%' )" update="false" insert="false" access="nosetter.camelcase"/> <!-- Using a formula seems to trigger it. I guess the query isn't being generated correctly when some formulas are used. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-04 17:27:52
|
Revision: 4039 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4039&view=rev Author: fabiomaulo Date: 2009-02-04 17:27:51 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Ignore tests specific for MsSQL Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1612/NativeSqlCollectionLoaderFixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1612/NativeSqlCollectionLoaderFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1612/NativeSqlCollectionLoaderFixture.cs 2009-02-04 17:25:35 UTC (rev 4038) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1612/NativeSqlCollectionLoaderFixture.cs 2009-02-04 17:27:51 UTC (rev 4039) @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using NHibernate.Dialect; using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; @@ -230,6 +231,10 @@ [Test] public void NativeUpdateQueryWithoutResults() { + if(!(Dialect is MsSql2000Dialect)) + { + Assert.Ignore("This does not apply to {0}", Dialect); + } using (ISession session = OpenSession()) { using (ITransaction tx = session.BeginTransaction()) @@ -243,6 +248,10 @@ [Test] public void NativeScalarQueryWithoutResults() { + if (!(Dialect is MsSql2000Dialect)) + { + Assert.Ignore("This does not apply to {0}", Dialect); + } using (ISession session = OpenSession()) { using (ITransaction tx = session.BeginTransaction()) @@ -258,6 +267,10 @@ [Test] public void NativeScalarQueryWithUndefinedResultset() { + if (!(Dialect is MsSql2000Dialect)) + { + Assert.Ignore("This does not apply to {0}", Dialect); + } using (ISession session = OpenSession()) { using (session.BeginTransaction()) @@ -273,6 +286,10 @@ [Test] public void NativeScalarQueryWithDefinedResultset() { + if (!(Dialect is MsSql2000Dialect)) + { + Assert.Ignore("This does not apply to {0}", Dialect); + } using (ISession session = OpenSession()) { using (session.BeginTransaction()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-04 17:25:48
|
Revision: 4038 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4038&view=rev Author: fabiomaulo Date: 2009-02-04 17:25:35 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Fix NH-1429 (Guid for Oracle) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs trunk/nhibernate/src/NHibernate/Driver/OracleClientDriver.cs trunk/nhibernate/src/NHibernate/Driver/OracleDataClientDriver.cs trunk/nhibernate/src/NHibernate/Type/GuidType.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs 2009-02-04 15:54:52 UTC (rev 4037) +++ trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs 2009-02-04 17:25:35 UTC (rev 4038) @@ -68,7 +68,7 @@ RegisterNumericTypeMappings(); RegisterDateTimeTypeMappings(); RegisterLargeObjectTypeMappings(); - + RegisterGuidTypeMapping(); RegisterReverseHibernateTypeMappings(); RegisterFunctions(); @@ -76,6 +76,11 @@ RegisterDefaultProperties(); } + protected virtual void RegisterGuidTypeMapping() + { + RegisterColumnType(DbType.Guid, "RAW(16)"); + } + protected virtual void RegisterCharacterTypeMappings() { RegisterColumnType(DbType.AnsiStringFixedLength, "CHAR(255)"); Modified: trunk/nhibernate/src/NHibernate/Driver/OracleClientDriver.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Driver/OracleClientDriver.cs 2009-02-04 15:54:52 UTC (rev 4037) +++ trunk/nhibernate/src/NHibernate/Driver/OracleClientDriver.cs 2009-02-04 17:25:35 UTC (rev 4038) @@ -1,5 +1,6 @@ using System.Data; using System.Data.OracleClient; +using NHibernate.SqlTypes; namespace NHibernate.Driver { @@ -8,6 +9,8 @@ /// </summary> public class OracleClientDriver : DriverBase { + private static readonly SqlType GuidSqlType = new SqlType(DbType.Binary, 16); + public override IDbConnection CreateConnection() { return new OracleConnection(); @@ -32,5 +35,17 @@ { get { return ":"; } } + + protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType) + { + if (sqlType.DbType == DbType.Guid) + { + base.InitializeParameter(dbParam, name, GuidSqlType); + } + else + { + base.InitializeParameter(dbParam, name, sqlType); + } + } } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Driver/OracleDataClientDriver.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Driver/OracleDataClientDriver.cs 2009-02-04 15:54:52 UTC (rev 4037) +++ trunk/nhibernate/src/NHibernate/Driver/OracleDataClientDriver.cs 2009-02-04 17:25:35 UTC (rev 4038) @@ -14,6 +14,7 @@ /// </remarks> public class OracleDataClientDriver : ReflectionBasedDriver, IEmbeddedBatcherFactoryProvider { + private static readonly SqlType GuidSqlType = new SqlType(DbType.Binary, 16); /// <summary> /// Initializes a new instance of <see cref="OracleDataClientDriver"/>. /// </summary> @@ -54,11 +55,18 @@ { // if the parameter coming in contains a boolean then we need to convert it // to another type since ODP.NET doesn't support DbType.Boolean - if (sqlType.DbType == DbType.Boolean) + switch (sqlType.DbType) { - sqlType = SqlTypeFactory.Int16; + case DbType.Boolean: + base.InitializeParameter(dbParam, name, SqlTypeFactory.Int16); + break; + case DbType.Guid: + base.InitializeParameter(dbParam, name, GuidSqlType); + break; + default: + base.InitializeParameter(dbParam, name, sqlType); + break; } - base.InitializeParameter(dbParam, name, sqlType); } #region IEmbeddedBatcherFactoryProvider Members Modified: trunk/nhibernate/src/NHibernate/Type/GuidType.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Type/GuidType.cs 2009-02-04 15:54:52 UTC (rev 4037) +++ trunk/nhibernate/src/NHibernate/Type/GuidType.cs 2009-02-04 17:25:35 UTC (rev 4038) @@ -28,10 +28,13 @@ { return rs.GetGuid(index); } - else + + if (rs.GetFieldType(index) == typeof(byte[])) { - return new Guid(Convert.ToString(rs[index])); - } + return new Guid((byte[])(rs[index])); + } + + return new Guid(Convert.ToString(rs[index])); } /// <summary> @@ -53,7 +56,9 @@ public override void Set(IDbCommand cmd, object value, int index) { - ((IDataParameter)cmd.Parameters[index]).Value = value; + var dp = (IDataParameter) cmd.Parameters[index]; + + dp.Value = dp.DbType == DbType.Binary ? ((Guid)value).ToByteArray() : value; } /// <summary></summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-04 15:54:56
|
Revision: 4037 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4037&view=rev Author: fabiomaulo Date: 2009-02-04 15:54:52 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Minor (reformatted) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Type/GuidType.cs trunk/nhibernate/src/NHibernate.Test/TypesTest/GuidTypeFixture.cs Modified: trunk/nhibernate/src/NHibernate/Type/GuidType.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Type/GuidType.cs 2009-02-04 14:28:13 UTC (rev 4036) +++ trunk/nhibernate/src/NHibernate/Type/GuidType.cs 2009-02-04 15:54:52 UTC (rev 4037) @@ -24,14 +24,14 @@ /// <returns></returns> public override object Get(IDataReader rs, int index) { - if (rs.GetFieldType(index) == typeof(Guid)) - { - return rs.GetGuid(index); - } - else - { - return new Guid(Convert.ToString(rs[index])); - } + if (rs.GetFieldType(index) == typeof (Guid)) + { + return rs.GetGuid(index); + } + else + { + return new Guid(Convert.ToString(rs[index])); + } } /// <summary> Modified: trunk/nhibernate/src/NHibernate.Test/TypesTest/GuidTypeFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/TypesTest/GuidTypeFixture.cs 2009-02-04 14:28:13 UTC (rev 4036) +++ trunk/nhibernate/src/NHibernate.Test/TypesTest/GuidTypeFixture.cs 2009-02-04 15:54:52 UTC (rev 4037) @@ -89,26 +89,26 @@ } } - [Test] - public void GetGuidWorksWhenUnderlyingTypeIsRepresentedByString() - { - GuidType type = (GuidType)NHibernateUtil.Guid; + [Test] + public void GetGuidWorksWhenUnderlyingTypeIsRepresentedByString() + { + GuidType type = (GuidType)NHibernateUtil.Guid; - Guid value = Guid.NewGuid(); - DataTable data = new DataTable("test"); - data.Columns.Add("guid", typeof(Guid)); - data.Columns.Add("varchar", typeof(string)); - DataRow row = data.NewRow(); - row["guid"] = value; - row["varchar"] = value.ToString(); - data.Rows.Add(row); - IDataReader reader = data.CreateDataReader(); - reader.Read(); + Guid value = Guid.NewGuid(); + DataTable data = new DataTable("test"); + data.Columns.Add("guid", typeof(Guid)); + data.Columns.Add("varchar", typeof(string)); + DataRow row = data.NewRow(); + row["guid"] = value; + row["varchar"] = value.ToString(); + data.Rows.Add(row); + IDataReader reader = data.CreateDataReader(); + reader.Read(); - Assert.AreEqual(value, type.Get(reader, "guid")); - Assert.AreEqual(value, type.Get(reader, 0)); - Assert.AreEqual(value, type.Get(reader, "varchar")); - Assert.AreEqual(value, type.Get(reader, 1)); - } + Assert.AreEqual(value, type.Get(reader, "guid")); + Assert.AreEqual(value, type.Get(reader, 0)); + Assert.AreEqual(value, type.Get(reader, "varchar")); + Assert.AreEqual(value, type.Get(reader, 1)); + } } } \ 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: <fab...@us...> - 2009-02-04 14:28:17
|
Revision: 4036 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4036&view=rev Author: fabiomaulo Date: 2009-02-04 14:28:13 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Minor Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2009-02-04 13:53:38 UTC (rev 4035) +++ trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2009-02-04 14:28:13 UTC (rev 4036) @@ -557,7 +557,7 @@ #endregion #region keyword support - protected internal virtual void RegisterKeyword(string word) + protected void RegisterKeyword(string word) { Keywords.Add(word); } Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2009-02-04 13:53:38 UTC (rev 4035) +++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2009-02-04 14:28:13 UTC (rev 4036) @@ -122,35 +122,7 @@ RegisterFunction("day", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(day, ?1)")); RegisterFunction("month", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(month, ?1)")); RegisterFunction("year", new SQLFunctionTemplate(NHibernateUtil.Int32, "datepart(year, ?1)")); - RegisterFunction("concat", new VarArgsSQLFunction(NHibernateUtil.String, "(", "+", ")")); - /* - RegisterFunction("julian_day", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - RegisterFunction("microsecond", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - RegisterFunction("midnight_seconds", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - RegisterFunction("monthname", new StandardSQLFunction( NHibernateUtil.String ) ); - RegisterFunction("quarter", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - RegisterFunction("date", new StandardSQLFunction(Hibernate.DATE) ); - RegisterFunction("dayname", new StandardSQLFunction( NHibernateUtil.String ) ); - RegisterFunction("dayofweek", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - RegisterFunction("dayofweek_iso", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - RegisterFunction("dayofyear", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - RegisterFunction("days", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - RegisterFunction("time", new StandardSQLFunction( NHibernateUtil.Time ) ); - RegisterFunction("timestamp", new StandardSQLFunction( NHibernateUtil.Timestamp ) ); - RegisterFunction("timestamp_iso", new StandardSQLFunction( NHibernateUtil.Timestamp ) ); - RegisterFunction("week", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - RegisterFunction("week_iso", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - - RegisterFunction("double", new StandardSQLFunction( NHibernateUtil.Double ) ); - RegisterFunction("varchar", new StandardSQLFunction( NHibernateUtil.String ) ); - RegisterFunction("real", new StandardSQLFunction( NHibernateUtil.Single ) ); - RegisterFunction("bigint", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - RegisterFunction("char", new StandardSQLFunction( NHibernateUtil.Character ) ); - RegisterFunction("integer", new StandardSQLFunction( NHibernateUtil.Int32 ) ); - RegisterFunction("smallint", new StandardSQLFunction( NHibernateUtil.Int16 ) ); - */ - RegisterFunction("digits", new StandardSQLFunction("digits", NHibernateUtil.String)); RegisterFunction("chr", new StandardSQLFunction("chr", NHibernateUtil.Character)); RegisterFunction("upper", new StandardSQLFunction("upper")); @@ -163,6 +135,8 @@ RegisterFunction("trim", new AnsiTrimEmulationFunction()); RegisterFunction("iif", new SQLFunctionTemplate(null, "case when ?1 then ?2 else ?3 end")); + RegisterKeyword("top"); + DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.SqlClientDriver"; DefaultProperties[Environment.PrepareSql] = "false"; } Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2009-02-04 13:53:38 UTC (rev 4035) +++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2009-02-04 14:28:13 UTC (rev 4036) @@ -16,7 +16,6 @@ RegisterColumnType(DbType.String, 1073741823, "NVARCHAR(MAX)"); RegisterColumnType(DbType.AnsiString, 2147483647, "VARCHAR(MAX)"); RegisterColumnType(DbType.Binary, 2147483647, "VARBINARY(MAX)"); - RegisterKeyword("top"); } /// <summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-02-04 13:53:41
|
Revision: 4035 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4035&view=rev Author: darioquintana Date: 2009-02-04 13:53:38 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Fix NH-1654 by Remco Ros Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs trunk/nhibernate/src/NHibernate/SqlCommand/Template.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Fixture.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2009-02-04 12:59:40 UTC (rev 4034) +++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2009-02-04 13:53:38 UTC (rev 4035) @@ -16,6 +16,7 @@ RegisterColumnType(DbType.String, 1073741823, "NVARCHAR(MAX)"); RegisterColumnType(DbType.AnsiString, 2147483647, "VARCHAR(MAX)"); RegisterColumnType(DbType.Binary, 2147483647, "VARBINARY(MAX)"); + RegisterKeyword("top"); } /// <summary> Modified: trunk/nhibernate/src/NHibernate/SqlCommand/Template.cs =================================================================== --- trunk/nhibernate/src/NHibernate/SqlCommand/Template.cs 2009-02-04 12:59:40 UTC (rev 4034) +++ trunk/nhibernate/src/NHibernate/SqlCommand/Template.cs 2009-02-04 13:53:38 UTC (rev 4035) @@ -311,7 +311,7 @@ return "(".Equals(nextToken) || Keywords.Contains(lcToken) || functionRegistry.HasFunction(lcToken) || - // TODO H3: dialect.Keywords.Contains(lcToken) || + dialect.Keywords.Contains(lcToken) || FunctionKeywords.Contains(lcToken); } Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Fixture.cs 2009-02-04 12:59:40 UTC (rev 4034) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Fixture.cs 2009-02-04 13:53:38 UTC (rev 4035) @@ -1,4 +1,5 @@ -using NUnit.Framework; +using NHibernate.Dialect; +using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1654 { @@ -10,7 +11,12 @@ get { return "NH1654"; } } - [Test,Ignore] + protected override bool AppliesTo(NHibernate.Dialect.Dialect dialect) + { + return dialect is MsSql2000Dialect; + } + + [Test] public void Test() { int employeeId; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-02-04 12:59:44
|
Revision: 4034 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4034&view=rev Author: darioquintana Date: 2009-02-04 12:59:40 +0000 (Wed, 04 Feb 2009) Log Message: ----------- adding test for NH-1654 Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Employee.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Mappings.hbm.xml Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Employee.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Employee.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Employee.cs 2009-02-04 12:59:40 UTC (rev 4034) @@ -0,0 +1,11 @@ +namespace NHibernate.Test.NHSpecificTest.NH1654 +{ + public class Employee + { + public virtual int Id { get; set; } + + public virtual string FirstName { get; set; } + + public virtual string FirstNameFormula { get; set; } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Fixture.cs 2009-02-04 12:59:40 UTC (rev 4034) @@ -0,0 +1,48 @@ +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1654 +{ + [TestFixture] + public class Fixture : BugTestCase + { + public override string BugNumber + { + get { return "NH1654"; } + } + + [Test,Ignore] + public void Test() + { + int employeeId; + using (ISession sess = OpenSession()) + using (ITransaction tx = sess.BeginTransaction()) + { + var emp = new Employee(); + emp.Id = 1; + emp.FirstName = "John"; + + sess.Save(emp); + + tx.Commit(); + + employeeId = emp.Id; + } + + using (ISession sess = OpenSession()) + using (ITransaction tx = sess.BeginTransaction()) + { + var load = sess.Load<Employee>(employeeId); + Assert.AreEqual("John", load.FirstNameFormula); + + tx.Commit(); + } + + using (ISession sess = OpenSession()) + using (ITransaction tx = sess.BeginTransaction()) + { + sess.Delete("from Employee"); + tx.Commit(); + } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1654/Mappings.hbm.xml 2009-02-04 12:59:40 UTC (rev 4034) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.NH1654" + assembly="NHibernate.Test"> + + <class name="Employee" table="EMPLOYEES" > + <id name="Id" column="EMPLOYEE_ID" type="Int32"> + <generator class="assigned" /> + </id> + <property name="FirstName" column="FirstName" type="String" /> + <property name="FirstNameFormula" + formula="(SELECT TOP 1 FirstName FROM EMPLOYEES e WHERE e.EMPLOYEE_ID = EMPLOYEE_ID)" + /> + + </class> +</hibernate-mapping> \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-02-04 04:46:26 UTC (rev 4033) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-02-04 12:59:40 UTC (rev 4034) @@ -593,6 +593,8 @@ <Compile Include="NHSpecificTest\NH1643\Department.cs" /> <Compile Include="NHSpecificTest\NH1643\Employee.cs" /> <Compile Include="NHSpecificTest\NH1643\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1654\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1654\Employee.cs" /> <Compile Include="NHSpecificTest\NH280\Fixture.cs" /> <Compile Include="NHSpecificTest\NH280\Foo.cs" /> <Compile Include="NHSpecificTest\NH1018\Employee.cs" /> @@ -1617,6 +1619,7 @@ <EmbeddedResource Include="Cascade\JobBatch.hbm.xml" /> <EmbeddedResource Include="Deletetransient\Person.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1654\Mappings.hbm.xml" /> <EmbeddedResource Include="Pagination\DataPoint.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\DateTime2AndDateTimeOffSet\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\Futures\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-04 04:46:31
|
Revision: 4033 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4033&view=rev Author: fabiomaulo Date: 2009-02-04 04:46:26 +0000 (Wed, 04 Feb 2009) Log Message: ----------- compatible only with .NET2.0 SP1 Modified Paths: -------------- trunk/nhibernate/releasenotes.txt Modified: trunk/nhibernate/releasenotes.txt =================================================================== --- trunk/nhibernate/releasenotes.txt 2009-02-04 04:24:02 UTC (rev 4032) +++ trunk/nhibernate/releasenotes.txt 2009-02-04 04:46:26 UTC (rev 4033) @@ -4,6 +4,7 @@ ##### Run time ##### * If you want work using lazy loading with LinFu.DynamicProxy now you must deploy NHibernate.ByteCode.LinFu.dll * If you want work using lazy loading with Castle.DynamicProxy2 now you must deploy NHibernate.ByteCode.Castle.dll + * compatible only with .NET2.0 SP1 or above (System.DateTimeOffset) ##### Possible Breaking Changes for external frameworks ##### * ISession interface have additional methods This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-04 04:24:08
|
Revision: 4032 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4032&view=rev Author: fabiomaulo Date: 2009-02-04 04:24:02 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Arranged test for Oracle Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1394/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1394/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1394/Fixture.cs 2009-02-04 04:21:16 UTC (rev 4031) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1394/Fixture.cs 2009-02-04 04:24:02 UTC (rev 4032) @@ -1,5 +1,6 @@ using System.Collections.Generic; using NHibernate.Criterion; +using NHibernate.Dialect; using NHibernate.Dialect.Function; using NUnit.Framework; @@ -80,10 +81,15 @@ ICriteria c = s.CreateCriteria(typeof (Person)).AddOrder(Order.Asc(Projections.SubQuery(dc))); IList<Person> list = c.List<Person>(); - - Assert.AreEqual(list[2].Name, "Tim"); - Assert.AreEqual(list[3].Name, "Joe"); - Assert.AreEqual(list[4].Name, "Sally"); + int nullRelationOffSet = 2; + if (Dialect is Oracle8iDialect) + { + // Oracle order NULL Last (ASC) + nullRelationOffSet = 0; + } + Assert.AreEqual(list[nullRelationOffSet].Name, "Tim"); + Assert.AreEqual(list[nullRelationOffSet+1].Name, "Joe"); + Assert.AreEqual(list[nullRelationOffSet+2].Name, "Sally"); } } @@ -99,9 +105,15 @@ ICriteria c = s.CreateCriteria(typeof (Person)).AddOrder(Order.Desc(Projections.SubQuery(dc))); IList<Person> list = c.List<Person>(); - Assert.AreEqual(list[2].Name, "Tim"); - Assert.AreEqual(list[1].Name, "Joe"); - Assert.AreEqual(list[0].Name, "Sally"); + int nullRelationOffSet = 0; + if (Dialect is Oracle8iDialect) + { + // Oracle order NULL First (DESC) + nullRelationOffSet = 2; + } + Assert.AreEqual(list[nullRelationOffSet+2].Name, "Tim"); + Assert.AreEqual(list[nullRelationOffSet+1].Name, "Joe"); + Assert.AreEqual(list[nullRelationOffSet].Name, "Sally"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-02-04 04:21:18
|
Revision: 4031 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4031&view=rev Author: darioquintana Date: 2009-02-04 04:21:16 +0000 (Wed, 04 Feb 2009) Log Message: ----------- renaming the fixture and using removed Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/FutureQueryFixture.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/FutureCriteriaFixture.cs Removed Paths: ------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/Fixture.cs Deleted: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/Fixture.cs 2009-02-04 04:18:37 UTC (rev 4030) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/Fixture.cs 2009-02-04 04:21:16 UTC (rev 4031) @@ -1,124 +0,0 @@ -using NHibernate.Criterion; -using NHibernate.Impl; -using NUnit.Framework; - -namespace NHibernate.Test.NHSpecificTest.Futures -{ - using System.Collections; - - [TestFixture] - public class Fixture : TestCase - { - - protected override IList Mappings - { - get { return new string[] { "NHSpecificTest.Futures.Mappings.hbm.xml" }; } - } - - protected override string MappingsAssembly - { - get { return "NHibernate.Test"; } - } - - [Test] - public void CanUseFutureCriteria() - { - using (var s = sessions.OpenSession()) - { - if(((SessionFactoryImpl)sessions) - .ConnectionProvider.Driver.SupportsMultipleQueries == false) - { - Assert.Ignore("Not applicable for dialects that do not support multiple queries"); - } - - var persons10 = s.CreateCriteria(typeof(Person)) - .SetMaxResults(10) - .Future<Person>(); - var persons5 = s.CreateCriteria(typeof(Person)) - .SetMaxResults(5) - .Future<int>(); - - using (var logSpy = new SqlLogSpy()) - { - foreach (var person in persons5) - { - - } - - foreach (var person in persons10) - { - - } - - var events = logSpy.Appender.GetEvents(); - Assert.AreEqual(1, events.Length); - } - } - } - - [Test] - public void TwoFuturesRunInTwoRoundTrips() - { - using (var s = sessions.OpenSession()) - { - if (((SessionFactoryImpl)sessions) - .ConnectionProvider.Driver.SupportsMultipleQueries == false) - { - Assert.Ignore("Not applicable for dialects that do not support multiple queries"); - } - - using (var logSpy = new SqlLogSpy()) - { - var persons10 = s.CreateCriteria(typeof(Person)) - .SetMaxResults(10) - .Future<Person>(); - - foreach (var person in persons10) { } // fire first future round-trip - - var persons5 = s.CreateCriteria(typeof(Person)) - .SetMaxResults(5) - .Future<int>(); - - foreach (var person in persons5) { } // fire second future round-trip - - var events = logSpy.Appender.GetEvents(); - Assert.AreEqual(2, events.Length); - } - } - } - - [Test] - public void CanCombineSingleFutureValueWithEnumerableFutures() - { - using (var s = sessions.OpenSession()) - { - if (((SessionFactoryImpl)sessions) - .ConnectionProvider.Driver.SupportsMultipleQueries == false) - { - Assert.Ignore("Not applicable for dialects that do not support multiple queries"); - } - - var persons = s.CreateCriteria(typeof(Person)) - .SetMaxResults(10) - .Future<Person>(); - - var personCount = s.CreateCriteria(typeof(Person)) - .SetProjection(Projections.RowCount()) - .FutureValue<int>(); - - using (var logSpy = new SqlLogSpy()) - { - int count = personCount.Value; - - foreach (var person in persons) - { - - } - - var events = logSpy.Appender.GetEvents(); - Assert.AreEqual(1, events.Length); - } - } - } - } -} Copied: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/FutureCriteriaFixture.cs (from rev 4029, trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/Fixture.cs) =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/FutureCriteriaFixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/FutureCriteriaFixture.cs 2009-02-04 04:21:16 UTC (rev 4031) @@ -0,0 +1,124 @@ +using NHibernate.Criterion; +using NHibernate.Impl; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.Futures +{ + using System.Collections; + + [TestFixture] + public class FutureCriteriaFixture : TestCase + { + + protected override IList Mappings + { + get { return new string[] { "NHSpecificTest.Futures.Mappings.hbm.xml" }; } + } + + protected override string MappingsAssembly + { + get { return "NHibernate.Test"; } + } + + [Test] + public void CanUseFutureCriteria() + { + using (var s = sessions.OpenSession()) + { + if(((SessionFactoryImpl)sessions) + .ConnectionProvider.Driver.SupportsMultipleQueries == false) + { + Assert.Ignore("Not applicable for dialects that do not support multiple queries"); + } + + var persons10 = s.CreateCriteria(typeof(Person)) + .SetMaxResults(10) + .Future<Person>(); + var persons5 = s.CreateCriteria(typeof(Person)) + .SetMaxResults(5) + .Future<int>(); + + using (var logSpy = new SqlLogSpy()) + { + foreach (var person in persons5) + { + + } + + foreach (var person in persons10) + { + + } + + var events = logSpy.Appender.GetEvents(); + Assert.AreEqual(1, events.Length); + } + } + } + + [Test] + public void TwoFuturesRunInTwoRoundTrips() + { + using (var s = sessions.OpenSession()) + { + if (((SessionFactoryImpl)sessions) + .ConnectionProvider.Driver.SupportsMultipleQueries == false) + { + Assert.Ignore("Not applicable for dialects that do not support multiple queries"); + } + + using (var logSpy = new SqlLogSpy()) + { + var persons10 = s.CreateCriteria(typeof(Person)) + .SetMaxResults(10) + .Future<Person>(); + + foreach (var person in persons10) { } // fire first future round-trip + + var persons5 = s.CreateCriteria(typeof(Person)) + .SetMaxResults(5) + .Future<int>(); + + foreach (var person in persons5) { } // fire second future round-trip + + var events = logSpy.Appender.GetEvents(); + Assert.AreEqual(2, events.Length); + } + } + } + + [Test] + public void CanCombineSingleFutureValueWithEnumerableFutures() + { + using (var s = sessions.OpenSession()) + { + if (((SessionFactoryImpl)sessions) + .ConnectionProvider.Driver.SupportsMultipleQueries == false) + { + Assert.Ignore("Not applicable for dialects that do not support multiple queries"); + } + + var persons = s.CreateCriteria(typeof(Person)) + .SetMaxResults(10) + .Future<Person>(); + + var personCount = s.CreateCriteria(typeof(Person)) + .SetProjection(Projections.RowCount()) + .FutureValue<int>(); + + using (var logSpy = new SqlLogSpy()) + { + int count = personCount.Value; + + foreach (var person in persons) + { + + } + + var events = logSpy.Appender.GetEvents(); + Assert.AreEqual(1, events.Length); + } + } + } + } +} Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/FutureQueryFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/FutureQueryFixture.cs 2009-02-04 04:18:37 UTC (rev 4030) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/FutureQueryFixture.cs 2009-02-04 04:21:16 UTC (rev 4031) @@ -1,5 +1,4 @@ -using NHibernate.Criterion; -using NHibernate.Impl; +using NHibernate.Impl; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.Futures Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-02-04 04:18:37 UTC (rev 4030) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-02-04 04:21:16 UTC (rev 4031) @@ -381,7 +381,7 @@ <Compile Include="NHSpecificTest\BugTestCase.cs" /> <Compile Include="NHSpecificTest\CollectionFixture.cs" /> <Compile Include="NHSpecificTest\Futures\FutureQueryFixture.cs" /> - <Compile Include="NHSpecificTest\Futures\Fixture.cs" /> + <Compile Include="NHSpecificTest\Futures\FutureCriteriaFixture.cs" /> <Compile Include="NHSpecificTest\Futures\Person.cs" /> <Compile Include="NHSpecificTest\DateTime2AndDateTimeOffSet\AllDates.cs" /> <Compile Include="NHSpecificTest\DateTime2AndDateTimeOffSet\DateTime2AndDateTimeOffSetFixture.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-02-04 04:19:04
|
Revision: 4030 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4030&view=rev Author: darioquintana Date: 2009-02-04 04:18:37 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Exception Converter example for PostgreSQL Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs Added: trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/PostgresExceptionConverterExample.cs 2009-02-04 04:18:37 UTC (rev 4030) @@ -0,0 +1,31 @@ +using System; +using System.Data.Common; +using NHibernate; +using NHibernate.Exceptions; +using NHibernate.SqlCommand; + +public class PostgresExceptionConverterExample : ISQLExceptionConverter +{ + #region ISQLExceptionConverter Members + + public ADOException Convert(Exception sqlException, string message, SqlString sql) + { + var sqle = ADOExceptionHelper.ExtractDbException(sqlException) as DbException; + if (sqle != null) + { + string code = (string) sqle.GetType().GetProperty("Code").GetValue(sqle, null); + + if (code == "23503") + { + return new ConstraintViolationException(message, sqle.InnerException, sql, null); + } + if (code == "42P01") + { + return new SQLGrammarException(message, sqle.InnerException, sql); + } + } + return SQLStateConverter.HandledNonSpecificException(sqlException, message, sql); + } + + #endregion +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs 2009-02-04 03:40:06 UTC (rev 4029) +++ trunk/nhibernate/src/NHibernate.Test/ExceptionsTest/SQLExceptionConversionTest.cs 2009-02-04 04:18:37 UTC (rev 4030) @@ -33,6 +33,12 @@ configuration.SetProperty(Cfg.Environment.SqlExceptionConverter, typeof(OracleClientExceptionConverterExample).AssemblyQualifiedName); } + + if (Dialect is PostgreSQL82Dialect) + { + configuration.SetProperty(Cfg.Environment.SqlExceptionConverter, + typeof(PostgresExceptionConverterExample).AssemblyQualifiedName); + } } [Test] Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-02-04 03:40:06 UTC (rev 4029) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-02-04 04:18:37 UTC (rev 4030) @@ -196,6 +196,7 @@ <Compile Include="Events\Collections\IParentWithCollection.cs" /> <Compile Include="Events\Collections\Values\ParentWithCollectionOfValues.cs" /> <Compile Include="Events\Collections\Values\ValuesBagCollectionEventFixture.cs" /> + <Compile Include="ExceptionsTest\PostgresExceptionConverterExample.cs" /> <Compile Include="ExceptionsTest\Group.cs" /> <Compile Include="ExceptionsTest\MSSQLExceptionConverterExample.cs" /> <Compile Include="ExceptionsTest\OracleClientExceptionConverterExample.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-02-04 03:40:24
|
Revision: 4029 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4029&view=rev Author: darioquintana Date: 2009-02-04 03:40:06 +0000 (Wed, 04 Feb 2009) Log Message: ----------- minor bug Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/Mappings.hbm.xml Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/Mappings.hbm.xml 2009-02-04 02:48:45 UTC (rev 4028) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/Mappings.hbm.xml 2009-02-04 03:40:06 UTC (rev 4029) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" - namespace="NHibernate.Test.NHSpecificTest.MsSql2008" + namespace="NHibernate.Test.NHSpecificTest.DateTime2AndDateTimeOffSet" assembly="NHibernate.Test"> <class name="AllDates" lazy="false"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-02-04 02:49:05
|
Revision: 4028 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4028&view=rev Author: darioquintana Date: 2009-02-04 02:48:45 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Minor: Fixing indentation and renaming a test. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/NHibernateUtil.cs trunk/nhibernate/src/NHibernate/SqlTypes/SqlTypeFactory.cs trunk/nhibernate/src/NHibernate/Type/DateTime2Type.cs trunk/nhibernate/src/NHibernate/Type/DateTimeOffSetType.cs trunk/nhibernate/src/NHibernate/Type/DateTimeType.cs trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/AllDates.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/DateTime2AndDateTimeOffSetFixture.cs Modified: trunk/nhibernate/src/NHibernate/NHibernateUtil.cs =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernateUtil.cs 2009-02-03 22:49:04 UTC (rev 4027) +++ trunk/nhibernate/src/NHibernate/NHibernateUtil.cs 2009-02-04 02:48:45 UTC (rev 4028) @@ -115,15 +115,15 @@ /// </summary> public static readonly NullableType DateTime = new DateTimeType(); - /// <summary> - /// NHibernate date type - /// </summary> - public static readonly NullableType DateTime2 = new DateTime2Type(); + /// <summary> + /// NHibernate date type + /// </summary> + public static readonly NullableType DateTime2 = new DateTime2Type(); - /// <summary> - /// NHibernate date type - /// </summary> - public static readonly NullableType DateTimeOffset = new DateTimeOffsetType(); + /// <summary> + /// NHibernate date type + /// </summary> + public static readonly NullableType DateTimeOffset = new DateTimeOffsetType(); /// <summary> /// NHibernate date type Modified: trunk/nhibernate/src/NHibernate/SqlTypes/SqlTypeFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/SqlTypes/SqlTypeFactory.cs 2009-02-03 22:49:04 UTC (rev 4027) +++ trunk/nhibernate/src/NHibernate/SqlTypes/SqlTypeFactory.cs 2009-02-04 02:48:45 UTC (rev 4028) @@ -25,8 +25,8 @@ public static readonly SqlType Currency = new SqlType(DbType.Currency); public static readonly SqlType Date = new SqlType(DbType.Date); public static readonly SqlType DateTime = new SqlType(DbType.DateTime); - public static readonly SqlType DateTime2 = new SqlType(DbType.DateTime2); - public static readonly SqlType DateTimeOffSet = new SqlType(DbType.DateTimeOffset); + public static readonly SqlType DateTime2 = new SqlType(DbType.DateTime2); + public static readonly SqlType DateTimeOffSet = new SqlType(DbType.DateTimeOffset); public static readonly SqlType Decimal = new SqlType(DbType.Decimal); public static readonly SqlType Double = new SqlType(DbType.Double); public static readonly SqlType Int16 = new SqlType(DbType.Int16); Modified: trunk/nhibernate/src/NHibernate/Type/DateTime2Type.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Type/DateTime2Type.cs 2009-02-03 22:49:04 UTC (rev 4027) +++ trunk/nhibernate/src/NHibernate/Type/DateTime2Type.cs 2009-02-04 02:48:45 UTC (rev 4028) @@ -4,20 +4,20 @@ namespace NHibernate.Type { - /// <summary> - /// Maps a <see cref="System.DateTime" /> Property to a <see cref="DbType.DateTime"/> - /// </summary> - [Serializable] - public class DateTime2Type : DateTimeType - { - /// <summary></summary> - internal DateTime2Type() : base(SqlTypeFactory.DateTime2) - { - } + /// <summary> + /// Maps a <see cref="System.DateTime" /> Property to a <see cref="DbType.DateTime"/> + /// </summary> + [Serializable] + public class DateTime2Type : DateTimeType + { + /// <summary></summary> + internal DateTime2Type() : base(SqlTypeFactory.DateTime2) + { + } - public override string Name - { - get { return "DateTime2"; } - } - } + public override string Name + { + get { return "DateTime2"; } + } + } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Type/DateTimeOffSetType.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Type/DateTimeOffSetType.cs 2009-02-03 22:49:04 UTC (rev 4027) +++ trunk/nhibernate/src/NHibernate/Type/DateTimeOffSetType.cs 2009-02-04 02:48:45 UTC (rev 4028) @@ -6,119 +6,119 @@ namespace NHibernate.Type { - /// <summary> - /// Maps a <see cref="System.DateTimeOffset" /> Property to a <see cref="DbType.DateTimeOffset"/> - /// </summary> - [Serializable] - public class DateTimeOffsetType : DateTimeType - { - /// <summary></summary> - public DateTimeOffsetType() - : base(SqlTypeFactory.DateTimeOffSet) - { - } + /// <summary> + /// Maps a <see cref="System.DateTimeOffset" /> Property to a <see cref="DbType.DateTimeOffset"/> + /// </summary> + [Serializable] + public class DateTimeOffsetType : DateTimeType + { + /// <summary></summary> + public DateTimeOffsetType() + : base(SqlTypeFactory.DateTimeOffSet) + { + } - public override string Name - { - get { return "DateTimeOffset"; } - } + public override string Name + { + get { return "DateTimeOffset"; } + } - public override System.Type ReturnedClass - { - get - { - return typeof(DateTimeOffset); - } - } + public override System.Type ReturnedClass + { + get { return typeof (DateTimeOffset); } + } - public override System.Type PrimitiveClass - { - get { return typeof(DateTimeOffset); } - } + public override System.Type PrimitiveClass + { + get { return typeof (DateTimeOffset); } + } - public override void Set(IDbCommand st, object value, int index) - { - DateTimeOffset dateValue = (DateTimeOffset)value; - ((IDataParameter) st.Parameters[index]).Value = - new DateTimeOffset(dateValue.Year, dateValue.Month, dateValue.Day, dateValue.Hour, dateValue.Minute, dateValue.Second,dateValue.Offset); - } - - public override object Get(IDataReader rs, int index) - { - try - { - DateTimeOffset dbValue = (DateTimeOffset)rs[index];; - return new DateTimeOffset(dbValue.Year, dbValue.Month, dbValue.Day, dbValue.Hour, dbValue.Minute, dbValue.Second,dbValue.Offset); - } - catch (Exception ex) - { - throw new FormatException(string.Format("Input string '{0}' was not in the correct format.", rs[index]), ex); - } - } + public override IComparer Comparator + { + get { return Comparer<DateTimeOffset>.Default; } + } - public override IComparer Comparator - { - get { return Comparer<DateTimeOffset>.Default; } - } + public override void Set(IDbCommand st, object value, int index) + { + var dateValue = (DateTimeOffset) value; + ((IDataParameter) st.Parameters[index]).Value = + new DateTimeOffset(dateValue.Year, dateValue.Month, dateValue.Day, dateValue.Hour, dateValue.Minute, + dateValue.Second, dateValue.Offset); + } - public override bool IsEqual(object x, object y) - { - if (x == y) - { - return true; - } + public override object Get(IDataReader rs, int index) + { + try + { + var dbValue = (DateTimeOffset) rs[index]; + ; + return new DateTimeOffset(dbValue.Year, dbValue.Month, dbValue.Day, dbValue.Hour, dbValue.Minute, dbValue.Second, + dbValue.Offset); + } + catch (Exception ex) + { + throw new FormatException(string.Format("Input string '{0}' was not in the correct format.", rs[index]), ex); + } + } - if (x == null || y == null) - { - return false; - } + public override bool IsEqual(object x, object y) + { + if (x == y) + { + return true; + } - DateTimeOffset date1 = (DateTimeOffset)x; - DateTimeOffset date2 = (DateTimeOffset)y; + if (x == null || y == null) + { + return false; + } - if (date1.Equals(date2)) - return true; + var date1 = (DateTimeOffset) x; + var date2 = (DateTimeOffset) y; - return (date1.Year == date2.Year && - date1.Month == date2.Month && - date1.Day == date2.Day && - date1.Hour == date2.Hour && - date1.Minute == date2.Minute && - date1.Second == date2.Second && - date1.Offset == date2.Offset); - } + if (date1.Equals(date2)) + return true; - public override int GetHashCode(object x, EntityMode entityMode) - { - // Custom hash code implementation because DateTimeType is only accurate - // up to seconds. - DateTimeOffset date = (DateTimeOffset)x; - int hashCode = 1; - unchecked - { - hashCode = 31 * hashCode + date.Second; - hashCode = 31 * hashCode + date.Minute; - hashCode = 31 * hashCode + date.Hour; - hashCode = 31 * hashCode + date.Day; - hashCode = 31 * hashCode + date.Month; - hashCode = 31 * hashCode + date.Year; - } - return hashCode; - } + return (date1.Year == date2.Year && + date1.Month == date2.Month && + date1.Day == date2.Day && + date1.Hour == date2.Hour && + date1.Minute == date2.Minute && + date1.Second == date2.Second && + date1.Offset == date2.Offset); + } - public override string ToString(object val) - { - return ((DateTimeOffset)val).ToString(); - } - - public override object FromStringValue(string xml) - { - return DateTimeOffset.Parse(xml); - } + public override int GetHashCode(object x, EntityMode entityMode) + { + // Custom hash code implementation because DateTimeType is only accurate + // up to seconds. + var date = (DateTimeOffset) x; + int hashCode = 1; + unchecked + { + hashCode = 31*hashCode + date.Second; + hashCode = 31*hashCode + date.Minute; + hashCode = 31*hashCode + date.Hour; + hashCode = 31*hashCode + date.Day; + hashCode = 31*hashCode + date.Month; + hashCode = 31*hashCode + date.Year; + } + return hashCode; + } - public override string ObjectToSQLString(object value, Dialect.Dialect dialect) - { - return "'" + ((DateTimeOffset)value) + "'"; - } - } + public override string ToString(object val) + { + return ((DateTimeOffset) val).ToString(); + } + + public override object FromStringValue(string xml) + { + return DateTimeOffset.Parse(xml); + } + + public override string ObjectToSQLString(object value, Dialect.Dialect dialect) + { + return "'" + ((DateTimeOffset) value) + "'"; + } + } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/Type/DateTimeType.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Type/DateTimeType.cs 2009-02-03 22:49:04 UTC (rev 4027) +++ trunk/nhibernate/src/NHibernate/Type/DateTimeType.cs 2009-02-04 02:48:45 UTC (rev 4028) @@ -26,9 +26,9 @@ { } - public DateTimeType(SqlType sqlTypeDateTime) : base(sqlTypeDateTime) - { - } + public DateTimeType(SqlType sqlTypeDateTime) : base(sqlTypeDateTime) + { + } /// <summary></summary> public override string Name Modified: trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs 2009-02-03 22:49:04 UTC (rev 4027) +++ trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs 2009-02-04 02:48:45 UTC (rev 4028) @@ -108,11 +108,11 @@ RegisterType(typeof(Byte), NHibernateUtil.Byte, "byte"); RegisterType(typeof(Char), NHibernateUtil.Character, "character"); RegisterType(typeof(CultureInfo), NHibernateUtil.CultureInfo, "locale"); - /*registering "datetime" after of "datetime2", - NH will choose "datetime" when no type is specified in the mapping*/ - RegisterType(typeof(DateTime), NHibernateUtil.DateTime2, "datetime2"); + /*registering "datetime" after of "datetime2", + NH will choose "datetime" when no type is specified in the mapping*/ + RegisterType(typeof(DateTime), NHibernateUtil.DateTime2, "datetime2"); RegisterType(typeof(DateTime), NHibernateUtil.DateTime, "datetime"); - RegisterType(typeof(DateTimeOffset), NHibernateUtil.DateTimeOffset, "datetimeoffset"); + RegisterType(typeof(DateTimeOffset), NHibernateUtil.DateTimeOffset, "datetimeoffset"); RegisterType(typeof(Decimal), NHibernateUtil.Decimal, "big_decimal"); RegisterType(typeof(Double), NHibernateUtil.Double, "double"); RegisterType(typeof(Guid), NHibernateUtil.Guid, "guid"); Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/AllDates.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/AllDates.cs 2009-02-03 22:49:04 UTC (rev 4027) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/AllDates.cs 2009-02-04 02:48:45 UTC (rev 4028) @@ -2,14 +2,14 @@ namespace NHibernate.Test.NHSpecificTest.DateTime2AndDateTimeOffSet { - public class AllDates - { - public int Id { get; set; } + public class AllDates + { + public int Id { get; set; } - public DateTime Sql_datetime { get; set; } + public DateTime Sql_datetime { get; set; } - public DateTime Sql_datetime2 { get; set; } + public DateTime Sql_datetime2 { get; set; } - public DateTimeOffset Sql_datetimeoffset { get; set; } - } + public DateTimeOffset Sql_datetimeoffset { get; set; } + } } \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/DateTime2AndDateTimeOffSetFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/DateTime2AndDateTimeOffSetFixture.cs 2009-02-03 22:49:04 UTC (rev 4027) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DateTime2AndDateTimeOffSet/DateTime2AndDateTimeOffSetFixture.cs 2009-02-04 02:48:45 UTC (rev 4028) @@ -6,81 +6,80 @@ namespace NHibernate.Test.NHSpecificTest.DateTime2AndDateTimeOffSet { - [TestFixture] - public class DateTime2AndDateTimeOffSetFixture : TestCase - { - protected override IList Mappings - { - get { return new[] { "NHSpecificTest.DateTime2AndDateTimeOffSet.Mappings.hbm.xml" }; } - } + [TestFixture] + public class DateTime2AndDateTimeOffSetFixture : TestCase + { + protected override IList Mappings + { + get { return new[] {"NHSpecificTest.DateTime2AndDateTimeOffSet.Mappings.hbm.xml"}; } + } - protected override string MappingsAssembly - { - get { return "NHibernate.Test"; } - } + protected override string MappingsAssembly + { + get { return "NHibernate.Test"; } + } - protected override bool AppliesTo(Dialect.Dialect dialect) - { - return dialect is MsSql2008Dialect; - } - + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return dialect is MsSql2008Dialect; + } - [Test] - public void Dates01() - { - var Now = DateTime.Now; - var NowOS = DateTimeOffset.Now; - var dates = new AllDates - { - Sql_datetime = Now, - Sql_datetime2 = DateTime.MinValue, - Sql_datetimeoffset = NowOS, - }; + public class DateTimeAssert + { + public static void AreEqual(DateTime dt1, DateTime dt2) + { + bool areEqual = new DateTimeType().IsEqual(dt1, dt2); - using(ISession s = OpenSession()) - using(ITransaction tx = s.BeginTransaction()) - { - s.Save(dates); - tx.Commit(); - } + if (!areEqual) + Assert.Fail("Expected {0} but was {1}"); + } - using(ISession s = OpenSession()) - using(ITransaction tx = s.BeginTransaction()) - { - var datesRecovered = s.CreateQuery("from AllDates").UniqueResult<AllDates>(); - - DateTimeAssert.AreEqual(datesRecovered.Sql_datetime,Now); - DateTimeAssert.AreEqual(datesRecovered.Sql_datetime2, DateTime.MinValue); - DateTimeAssert.AreEqual(datesRecovered.Sql_datetimeoffset, NowOS); - } + public static void AreEqual(DateTimeOffset dt1, DateTimeOffset dt2) + { + bool areEqual = new DateTimeOffsetType().IsEqual(dt1, dt2); - using(ISession s = OpenSession()) - using (ITransaction tx = s.BeginTransaction()) - { - var datesRecovered = s.CreateQuery("from AllDates").UniqueResult<AllDates>(); - s.Delete(datesRecovered); - tx.Commit(); - } - } + if (!areEqual) + Assert.Fail("Expected {0} but was {1}"); + } + } - public class DateTimeAssert - { - public static void AreEqual(DateTime dt1,DateTime dt2) - { - bool areEqual = new DateTimeType().IsEqual(dt1,dt2); + [Test] + public void SavingAndRetrieving() + { + DateTime Now = DateTime.Now; + DateTimeOffset NowOS = DateTimeOffset.Now; + var dates = new AllDates + { + Sql_datetime = Now, + Sql_datetime2 = DateTime.MinValue, + Sql_datetimeoffset = NowOS, + }; - if(!areEqual) - Assert.Fail("Expected {0} but was {1}"); - } + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + s.Save(dates); + tx.Commit(); + } - public static void AreEqual(DateTimeOffset dt1, DateTimeOffset dt2) - { - bool areEqual = new DateTimeOffsetType().IsEqual(dt1, dt2); + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + var datesRecovered = s.CreateQuery("from AllDates").UniqueResult<AllDates>(); - if (!areEqual) - Assert.Fail("Expected {0} but was {1}"); - } - } - } + DateTimeAssert.AreEqual(datesRecovered.Sql_datetime, Now); + DateTimeAssert.AreEqual(datesRecovered.Sql_datetime2, DateTime.MinValue); + DateTimeAssert.AreEqual(datesRecovered.Sql_datetimeoffset, NowOS); + } + + using (ISession s = OpenSession()) + using (ITransaction tx = s.BeginTransaction()) + { + var datesRecovered = s.CreateQuery("from AllDates").UniqueResult<AllDates>(); + s.Delete(datesRecovered); + tx.Commit(); + } + } + } } \ 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: <fab...@us...> - 2009-02-03 22:49:08
|
Revision: 4027 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4027&view=rev Author: fabiomaulo Date: 2009-02-03 22:49:04 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Added test in pagination test Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs 2009-02-03 22:32:20 UTC (rev 4026) +++ trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs 2009-02-03 22:49:04 UTC (rev 4027) @@ -59,6 +59,10 @@ s.CreateCriteria(typeof (DataPoint)).AddOrder(Order.Asc("X")).AddOrder(Order.Asc("Y")).SetFirstResult(8).List(). Count; Assert.That(size, Is.EqualTo(2)); + size = + s.CreateCriteria(typeof(DataPoint)).AddOrder(Order.Asc("X")).AddOrder(Order.Asc("Y")).SetMaxResults(10).SetFirstResult(8).List(). + Count; + Assert.That(size, Is.EqualTo(2)); t.Commit(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-03 22:32:24
|
Revision: 4026 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4026&view=rev Author: fabiomaulo Date: 2009-02-03 22:32:20 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Simple Pagination test Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/Pagination/ trunk/nhibernate/src/NHibernate.Test/Pagination/DataPoint.cs trunk/nhibernate/src/NHibernate.Test/Pagination/DataPoint.hbm.xml trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-02-03 20:14:58 UTC (rev 4025) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-02-03 22:32:20 UTC (rev 4026) @@ -855,6 +855,8 @@ <Compile Include="Operations\PersonalDetails.cs" /> <Compile Include="Operations\TimestampedEntity.cs" /> <Compile Include="Operations\VersionedEntity.cs" /> + <Compile Include="Pagination\DataPoint.cs" /> + <Compile Include="Pagination\PaginationFixture.cs" /> <Compile Include="ProjectionFixtures\Key.cs" /> <Compile Include="ProjectionFixtures\Fixture.cs" /> <Compile Include="ProjectionFixtures\NodeType.cs" /> @@ -1614,6 +1616,7 @@ <EmbeddedResource Include="Cascade\JobBatch.hbm.xml" /> <EmbeddedResource Include="Deletetransient\Person.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="Pagination\DataPoint.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\DateTime2AndDateTimeOffSet\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\Futures\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1643\Mappings.hbm.xml" /> Added: trunk/nhibernate/src/NHibernate.Test/Pagination/DataPoint.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Pagination/DataPoint.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Pagination/DataPoint.cs 2009-02-03 22:32:20 UTC (rev 4026) @@ -0,0 +1,10 @@ +namespace NHibernate.Test.Pagination +{ + public class DataPoint + { + public virtual long Id { get; set; } + public virtual double X { get; set; } + public virtual double Y { get; set; } + public virtual string Description { get; set; } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/Pagination/DataPoint.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Pagination/DataPoint.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Pagination/DataPoint.hbm.xml 2009-02-03 22:32:20 UTC (rev 4026) @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.Pagination"> + + <class name="DataPoint" dynamic-update="true"> + <!--rowid="rowid"--> + <!-- remove this if not oracle --> + <id name="Id"> + <generator class="increment"/> + </id> + <property name="X"> + <column name="xval" not-null="true" precision="4" unique-key="xy"/> + </property> + <property name="Y"> + <column name="yval" not-null="true" precision="4" unique-key="xy"/> + </property> + <property name="Description"/> + </class> + +</hibernate-mapping> + Added: trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Pagination/PaginationFixture.cs 2009-02-03 22:32:20 UTC (rev 4026) @@ -0,0 +1,73 @@ +using System; +using System.Collections; +using NHibernate.Cfg; +using NHibernate.Criterion; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using Environment=NHibernate.Cfg.Environment; + +namespace NHibernate.Test.Pagination +{ + [TestFixture] + public class PaginationFixture : TestCase + { + protected override string MappingsAssembly + { + get { return "NHibernate.Test"; } + } + + protected override IList Mappings + { + get { return new[] {"Pagination.DataPoint.hbm.xml"}; } + } + + protected override void Configure(Configuration configuration) + { + cfg.SetProperty(Environment.DefaultBatchFetchSize, "20"); + } + + protected override string CacheConcurrencyStrategy + { + get { return null; } + } + + [Test] + public void PagTest() + { + using(ISession s = OpenSession()) + using (ITransaction t = s.BeginTransaction()) + { + for (int i = 0; i < 10; i++) + { + var dp = new DataPoint {X = (i * 0.1d)}; + dp.Y = Math.Cos(dp.X); + s.Persist(dp); + } + t.Commit(); + } + + using(ISession s = OpenSession()) + using (ITransaction t = s.BeginTransaction()) + { + int size = + s.CreateSQLQuery("select Id, xval, yval, Description from DataPoint order by xval, yval").AddEntity( + typeof (DataPoint)).SetMaxResults(5).List().Count; + Assert.That(size, Is.EqualTo(5)); + size = s.CreateQuery("from DataPoint dp order by dp.X, dp.Y").SetFirstResult(5).SetMaxResults(2).List().Count; + Assert.That(size, Is.EqualTo(2)); + size = + s.CreateCriteria(typeof (DataPoint)).AddOrder(Order.Asc("X")).AddOrder(Order.Asc("Y")).SetFirstResult(8).List(). + Count; + Assert.That(size, Is.EqualTo(2)); + t.Commit(); + } + + using(ISession s = OpenSession()) + using (ITransaction t = s.BeginTransaction()) + { + s.Delete("from DataPoint"); + t.Commit(); + } + } + } +} \ 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: <fab...@us...> - 2009-02-03 20:15:01
|
Revision: 4025 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4025&view=rev Author: fabiomaulo Date: 2009-02-03 20:14:58 +0000 (Tue, 03 Feb 2009) Log Message: ----------- minor Bug fix Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Engine/RowSelection.cs Modified: trunk/nhibernate/src/NHibernate/Engine/RowSelection.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Engine/RowSelection.cs 2009-02-03 18:36:08 UTC (rev 4024) +++ trunk/nhibernate/src/NHibernate/Engine/RowSelection.cs 2009-02-03 20:14:58 UTC (rev 4025) @@ -60,8 +60,7 @@ public bool DefinesLimits { - get { return maxRows != NoValue || firstRow != NoValue; } + get { return maxRows != NoValue || firstRow > 0; } } - } } \ 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: <fab...@us...> - 2009-02-03 18:36:15
|
Revision: 4024 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4024&view=rev Author: fabiomaulo Date: 2009-02-03 18:36:08 +0000 (Tue, 03 Feb 2009) Log Message: ----------- added Metadata support Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs 2009-02-03 17:16:02 UTC (rev 4023) +++ trunk/nhibernate/src/NHibernate/Dialect/Oracle8iDialect.cs 2009-02-03 18:36:08 UTC (rev 4024) @@ -2,11 +2,13 @@ using System.Collections; using System.Data; using NHibernate.Dialect.Function; +using NHibernate.Dialect.Schema; using NHibernate.Engine; using NHibernate.SqlCommand; using NHibernate.SqlTypes; using NHibernate.Type; using Environment=NHibernate.Cfg.Environment; +using System.Data.Common; namespace NHibernate.Dialect { @@ -413,6 +415,11 @@ get { return true; } } + public override IDataBaseSchema GetDataBaseSchema(DbConnection connection) + { + return new OracleDataBaseSchema(connection); + } + #region Overridden informational metadata public override bool SupportsEmptyInList This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-03 17:16:04
|
Revision: 4023 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4023&view=rev Author: fabiomaulo Date: 2009-02-03 17:16:02 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Ignoring test (Multi-query) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1253/Fixture.cs trunk/nhibernate/src/NHibernate.Test/ProjectionFixtures/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1253/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1253/Fixture.cs 2009-02-03 16:43:11 UTC (rev 4022) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1253/Fixture.cs 2009-02-03 17:16:02 UTC (rev 4023) @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using NHibernate.Driver; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1253 @@ -80,6 +81,12 @@ [Test] public void MultiQuerySingleInList() { + IDriver driver = sessions.ConnectionProvider.Driver; + if (!driver.SupportsMultipleQueries) + { + Assert.Ignore("Driver {0} does not support multi-queries", driver.GetType().FullName); + } + using (ISession s = OpenSession()) { using (ITransaction tx = s.BeginTransaction()) Modified: trunk/nhibernate/src/NHibernate.Test/ProjectionFixtures/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/ProjectionFixtures/Fixture.cs 2009-02-03 16:43:11 UTC (rev 4022) +++ trunk/nhibernate/src/NHibernate.Test/ProjectionFixtures/Fixture.cs 2009-02-03 17:16:02 UTC (rev 4023) @@ -1,7 +1,5 @@ -using System; -using NHibernate; using NHibernate.Criterion; -using NHibernate.Test.PropertyRef; +using NHibernate.Driver; using NUnit.Framework; namespace NHibernate.Test.ProjectionFixtures @@ -65,12 +63,17 @@ [Test] - [ExpectedException(typeof(ADOException), ExpectedMessage = @"could not execute query -[ SELECT this_.Id as y0_, count(this_.Area) as y1_ FROM TreeNode this_ WHERE this_.Id = @p0 ] -Positional parameters: #0>2 -[SQL: SELECT this_.Id as y0_, count(this_.Area) as y1_ FROM TreeNode this_ WHERE this_.Id = @p0]")] public void ErrorFromDBWillGiveTheActualSQLExecuted() { + string pName = ((ISqlParameterFormatter) sessions.ConnectionProvider.Driver).GetParameterName(0); + string expectedMessage = + string.Format( + @"could not execute query +[ SELECT this_.Id as y0_, count(this_.Area) as y1_ FROM TreeNode this_ WHERE this_.Id = {0} ] +Positional parameters: #0>2 +[SQL: SELECT this_.Id as y0_, count(this_.Area) as y1_ FROM TreeNode this_ WHERE this_.Id = {1}]", + pName, pName); + DetachedCriteria projection = DetachedCriteria.For<TreeNode>("child") .Add(Restrictions.Eq("child.Key.Id", 2)) .SetProjection( @@ -78,7 +81,8 @@ .Add(Projections.Property("child.Key.Id")) .Add(Projections.Count("child.Key.Area")) ); - + try + { using (var s = sessions.OpenSession()) using (var tx = s.BeginTransaction()) { @@ -87,6 +91,13 @@ tx.Commit(); } + Assert.Fail(); + } + catch (ADOException e) + { + if(e.Message != expectedMessage) + throw; + } } [Test] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-03 16:43:14
|
Revision: 4022 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4022&view=rev Author: fabiomaulo Date: 2009-02-03 16:43:11 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Ignore test for Oracle (cast issue) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/Criteria/ProjectionsTest.cs Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/ProjectionsTest.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Criteria/ProjectionsTest.cs 2009-02-03 16:22:49 UTC (rev 4021) +++ trunk/nhibernate/src/NHibernate.Test/Criteria/ProjectionsTest.cs 2009-02-03 16:43:11 UTC (rev 4022) @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using NHibernate.Criterion; +using NHibernate.Dialect; using NUnit.Framework; namespace NHibernate.Test.Criteria @@ -70,6 +71,10 @@ [Test] public void UsingSqlFunctions_Concat_WithCast() { + if(Dialect is Oracle8iDialect) + { + Assert.Ignore("Not supported by the active dialect:{0}.", Dialect); + } using (ISession session = sessions.OpenSession()) { string result = session.CreateCriteria(typeof(Student)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-03 16:22:55
|
Revision: 4021 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4021&view=rev Author: fabiomaulo Date: 2009-02-03 16:22:49 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Ignoring test (Multi-query) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Mappings.hbm.xml Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs 2009-02-03 16:11:00 UTC (rev 4020) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Fixture.cs 2009-02-03 16:22:49 UTC (rev 4021) @@ -1,74 +1,76 @@ using System.Collections; - using NHibernate.Criterion; -using NHibernate.Test.NHSpecificTest.NH1609; - +using NHibernate.Driver; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1609 { - [TestFixture] - public class Fixture : BugTestCase - { - [Test] - public void Test() - { - using (ISession session = sessions.OpenSession()) - using (ITransaction transaction = session.BeginTransaction()) - { - EntityA a1 = CreateEntityA(session); - EntityA a2 = CreateEntityA(session); - EntityC c = CreateEntityC(session); - EntityB b = CreateEntityB(session, a1, c); + [TestFixture] + public class Fixture : BugTestCase + { + [Test] + public void Test() + { + IDriver driver = sessions.ConnectionProvider.Driver; + if (!driver.SupportsMultipleQueries) + { + Assert.Ignore("Driver {0} does not support multi-queries", driver.GetType().FullName); + } + using (ISession session = sessions.OpenSession()) + { + using (ITransaction transaction = session.BeginTransaction()) + { + EntityA a1 = CreateEntityA(session); + EntityA a2 = CreateEntityA(session); + EntityC c = CreateEntityC(session); + EntityB b = CreateEntityB(session, a1, c); - // make sure the created entities are no longer in the session - session.Clear(); + // make sure the created entities are no longer in the session + session.Clear(); - IMultiCriteria multi = session.CreateMultiCriteria(); + IMultiCriteria multi = session.CreateMultiCriteria(); - // the first query is a simple select by id on EntityA - multi.Add(session.CreateCriteria(typeof(EntityA)).Add(Restrictions.Eq("Id", a1.Id))); - // the second query is also a simple select by id on EntityB - multi.Add(session.CreateCriteria(typeof(EntityA)).Add(Restrictions.Eq("Id", a2.Id))); - // the final query selects the first element (using SetFirstResult and SetMaxResults) for each EntityB where B.A.Id = a1.Id and B.C.Id = c.Id - // the problem is that the paged query uses parameters @p0 and @p1 instead of @p2 and @p3 - multi.Add( - session.CreateCriteria(typeof(EntityB)) - .Add(Restrictions.Eq("A.Id", a1.Id)) - .Add(Restrictions.Eq("C.Id", c.Id)) - .SetFirstResult(0) - .SetMaxResults(1)); + // the first query is a simple select by id on EntityA + multi.Add(session.CreateCriteria(typeof (EntityA)).Add(Restrictions.Eq("Id", a1.Id))); + // the second query is also a simple select by id on EntityB + multi.Add(session.CreateCriteria(typeof (EntityA)).Add(Restrictions.Eq("Id", a2.Id))); + // the final query selects the first element (using SetFirstResult and SetMaxResults) for each EntityB where B.A.Id = a1.Id and B.C.Id = c.Id + // the problem is that the paged query uses parameters @p0 and @p1 instead of @p2 and @p3 + multi.Add( + session.CreateCriteria(typeof (EntityB)).Add(Restrictions.Eq("A.Id", a1.Id)).Add(Restrictions.Eq("C.Id", c.Id)). + SetFirstResult(0).SetMaxResults(1)); - var results = multi.List(); + IList results = multi.List(); - Assert.AreEqual(1, ((IList)results[0]).Count); - Assert.AreEqual(1, ((IList)results[1]).Count); - Assert.AreEqual(1, ((IList)results[2]).Count); - } - } + Assert.AreEqual(1, ((IList) results[0]).Count); + Assert.AreEqual(1, ((IList) results[1]).Count); + Assert.AreEqual(1, ((IList) results[2]).Count); + } + } + } - private EntityA CreateEntityA(ISession session) - { - EntityA a = new EntityA(); - session.Save(a); - session.Flush(); - return a; - } + private EntityA CreateEntityA(ISession session) + { + var a = new EntityA(); + session.Save(a); + session.Flush(); + return a; + } - private EntityC CreateEntityC(ISession session) - { - EntityC c = new EntityC(); - session.Save(c); - session.Flush(); - return c; - } + private EntityC CreateEntityC(ISession session) + { + var c = new EntityC(); + session.Save(c); + session.Flush(); + return c; + } - private EntityB CreateEntityB(ISession session, EntityA a, EntityC c) - { - EntityB b = new EntityB { A = a, C = c }; - session.Save(b); - session.Flush(); - return b; - } - } -} + private EntityB CreateEntityB(ISession session, EntityA a, EntityC c) + { + var b = new EntityB {A = a, C = c}; + session.Save(b); + session.Flush(); + return b; + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Mappings.hbm.xml 2009-02-03 16:11:00 UTC (rev 4020) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1609/Mappings.hbm.xml 2009-02-03 16:22:49 UTC (rev 4021) @@ -5,13 +5,13 @@ <class name="EntityA" table="EntityA"> <id name="Id" column="Id" type="long"> - <generator class="identity"/> + <generator class="native"/> </id> </class> <class name="EntityB" table="EntityB"> <id name="Id" column="Id" type="long"> - <generator class="identity"/> + <generator class="native"/> </id> <many-to-one name="A" column="AId" class="EntityA" /> @@ -21,7 +21,7 @@ <class name="EntityC" table="EntityC"> <id name="Id" column="Id" type="long"> - <generator class="identity" /> + <generator class="native" /> </id> </class> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2009-02-03 16:11:10
|
Revision: 4020 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4020&view=rev Author: fabiomaulo Date: 2009-02-03 16:11:00 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Ignore some test for Oracle (cast issue) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs Modified: trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs 2009-02-03 13:55:19 UTC (rev 4019) +++ trunk/nhibernate/src/NHibernate.Test/Legacy/FooBarTest.cs 2009-02-03 16:11:00 UTC (rev 4020) @@ -2467,21 +2467,22 @@ s.CreateQuery("select count(*) from Bar as bar where 'abc' in elements(bar.Baz.FooArray)").List(); s.CreateQuery("select count(*) from Bar as bar where 1 in indices(bar.Baz.FooArray)").List(); s.CreateQuery( - "select count(*) from Bar as bar, bar.Component.Glarch.ProxyArray as g where cast(g.id as Int32) in indices(bar.Baz.FooArray)"). - List(); - s.CreateQuery( - "select max( elements(bar.Baz.FooArray) ) from Bar as bar, bar.Component.Glarch.ProxyArray as g where cast(g.id as Int32) in indices(bar.Baz.FooArray)") - .List(); - s.CreateQuery( "select count(*) from Bar as bar where '1' in (from bar.Component.Glarch.ProxyArray g where g.Name='foo')").List(); s.CreateQuery( "select count(*) from Bar as bar where '1' in (from g in bar.Component.Glarch.ProxyArray.elements where g.Name='foo')") .List(); // TODO: figure out why this is throwing an ORA-1722 error - if (!(Dialect is Oracle9Dialect)) + // probably the conversion ProxyArray.id (to_number ensuring a not null value) + if (!(Dialect is Oracle9Dialect) && !(Dialect is Oracle8iDialect)) { s.CreateQuery( + "select count(*) from Bar as bar, bar.Component.Glarch.ProxyArray as g where cast(g.id as Int32) in indices(bar.Baz.FooArray)"). + List(); + s.CreateQuery( + "select max( elements(bar.Baz.FooArray) ) from Bar as bar, bar.Component.Glarch.ProxyArray as g where cast(g.id as Int32) in indices(bar.Baz.FooArray)") + .List(); + s.CreateQuery( "select count(*) from Bar as bar left outer join bar.Component.Glarch.ProxyArray as pg where '1' in (from g in bar.Component.Glarch.ProxyArray)") .List(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |