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: T. T. <te...@gm...> - 2008-12-16 18:42:07
|
Great! I'm glad you noticed the code piece for validate thing. On Tue, Dec 16, 2008 at 8:39 PM, <fab...@us...> wrote: > Revision: 3958 > > http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3958&view=rev > Author: fabiomaulo > Date: 2008-12-16 18:39:12 +0000 (Tue, 16 Dec 2008) > > Log Message: > ----------- > - Fix NH-1443 > - prevent another bug on PK > > Modified Paths: > -------------- > trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs > trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs > trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs > trunk/nhibernate/src/NHibernate/Mapping/PrimaryKey.cs > trunk/nhibernate/src/NHibernate/Mapping/Table.cs > trunk/nhibernate/src/NHibernate.Test/MappingTest/TableFixture.cs > trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj > > Added Paths: > ----------- > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/ > > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithDefault.hbm.xml > > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithNothing.hbm.xml > > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithSpecific.hbm.xml > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs > > Modified: trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs > =================================================================== > --- trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2008-12-16 16:17:49 > UTC (rev 3957) > +++ trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2008-12-16 18:39:12 > UTC (rev 3958) > @@ -289,6 +289,7 @@ > Table table = new DenormalizedTable(includedTable); > table.IsAbstract = isAbstract; > table.Name = name; > + table.Catalog = catalog; > table.Schema = schema; > table.Subselect = subselect; > tables[key] = table; > > Modified: > trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs > =================================================================== > --- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs > 2008-12-16 16:17:49 UTC (rev 3957) > +++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs > 2008-12-16 18:39:12 UTC (rev 3958) > @@ -44,6 +44,7 @@ > private void SetMappingsProperties(HbmMapping mappingSchema) > { > mappings.SchemaName = mappingSchema.schema; > + mappings.CatalogName = mappingSchema.catalog; > mappings.DefaultCascade = > mappingSchema.defaultcascade; > mappings.DefaultAccess = > mappingSchema.defaultaccess; > mappings.DefaultLazy = mappingSchema.defaultlazy; > > Modified: > trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs > =================================================================== > --- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs > 2008-12-16 16:17:49 UTC (rev 3957) > +++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs > 2008-12-16 18:39:12 UTC (rev 3958) > @@ -20,7 +20,7 @@ > > //TABLENAME > string schema = classSchema.schema ?? > mappings.SchemaName; > - string catalog = mappings.CatalogName; //string > catalog = classSchema.catalog ?? mappings.CatalogName; > + string catalog = classSchema.catalog ?? > mappings.CatalogName; > string tableName = GetClassTableName(rootClass, > classSchema); > if (string.IsNullOrEmpty(tableName)) > { > > Modified: trunk/nhibernate/src/NHibernate/Mapping/PrimaryKey.cs > =================================================================== > --- trunk/nhibernate/src/NHibernate/Mapping/PrimaryKey.cs 2008-12-16 > 16:17:49 UTC (rev 3957) > +++ trunk/nhibernate/src/NHibernate/Mapping/PrimaryKey.cs 2008-12-16 > 18:39:12 UTC (rev 3958) > @@ -76,7 +76,7 @@ > public override string SqlDropString(Dialect.Dialect > dialect, string defaultCatalog, string defaultSchema) > { > string ifExists = > dialect.GetIfExistsDropConstraint(Table, Name); > - string drop = string.Format("alter table {0}{1}", > Table.GetQualifiedName(dialect, defaultSchema), > dialect.GetDropPrimaryKeyConstraintString(Name)); > + string drop = string.Format("alter table {0}{1}", > Table.GetQualifiedName(dialect, defaultCatalog, defaultSchema), > dialect.GetDropPrimaryKeyConstraintString(Name)); > string end = > dialect.GetIfExistsDropConstraintEnd(Table, Name); > return ifExists + Environment.NewLine + drop + > Environment.NewLine + end; > } > > Modified: trunk/nhibernate/src/NHibernate/Mapping/Table.cs > =================================================================== > --- trunk/nhibernate/src/NHibernate/Mapping/Table.cs 2008-12-16 16:17:49 > UTC (rev 3957) > +++ trunk/nhibernate/src/NHibernate/Mapping/Table.cs 2008-12-16 18:39:12 > UTC (rev 3958) > @@ -118,14 +118,10 @@ > /// Gets the schema qualified name of the Table using the > specified qualifier > /// </summary> > /// <param name="dialect">The <see cref="Dialect"/> that > knows how to Quote the Table name.</param> > - /// <param name="defaultQualifier">The Qualifier to use > when accessing the table.</param> > + /// <param name="defaultCatalog">The catalog name.</param> > + /// <param name="defaultSchema">The schema name.</param> > /// <returns>A String representing the Qualified > name.</returns> > /// <remarks>If this were used with MSSQL it would return a > dbo.table_name.</remarks> > - public string GetQualifiedName(Dialect.Dialect dialect, > string defaultQualifier) > - { > - return GetQualifiedName(dialect, null, > defaultQualifier); > - } > - > public virtual string GetQualifiedName(Dialect.Dialect > dialect, string defaultCatalog, string defaultSchema) > { > if (!string.IsNullOrEmpty(subselect)) > @@ -410,7 +406,7 @@ > > dialect.CreateTableString > : > dialect.CreateMultisetTableString) > .Append(' ') > - .Append(GetQualifiedName(dialect, > defaultSchema)) > + .Append(GetQualifiedName(dialect, > defaultCatalog, defaultSchema)) > .Append(" ("); > > bool identityColumn = idValue != null && > idValue.IsIdentityColumn(dialect); > > Modified: trunk/nhibernate/src/NHibernate.Test/MappingTest/TableFixture.cs > =================================================================== > --- trunk/nhibernate/src/NHibernate.Test/MappingTest/TableFixture.cs > 2008-12-16 16:17:49 UTC (rev 3957) > +++ trunk/nhibernate/src/NHibernate.Test/MappingTest/TableFixture.cs > 2008-12-16 18:39:12 UTC (rev 3958) > @@ -20,9 +20,9 @@ > > Assert.AreEqual("[keyword]", > tbl.GetQuotedName(dialect)); > > - Assert.AreEqual("dbo.[keyword]", > tbl.GetQualifiedName(dialect, "dbo")); > + Assert.AreEqual("dbo.[keyword]", > tbl.GetQualifiedName(dialect, null, "dbo")); > > - Assert.AreEqual("[keyword]", > tbl.GetQualifiedName(dialect, null)); > + Assert.AreEqual("[keyword]", > tbl.GetQualifiedName(dialect, null, null)); > > tbl.Schema = "sch"; > > @@ -39,9 +39,9 @@ > > Assert.AreEqual("notkeyword", > tbl.GetQuotedName(dialect)); > > - Assert.AreEqual("dbo.notkeyword", > tbl.GetQualifiedName(dialect, "dbo")); > + Assert.AreEqual("dbo.notkeyword", > tbl.GetQualifiedName(dialect, null, "dbo")); > > - Assert.AreEqual("notkeyword", > tbl.GetQualifiedName(dialect, null)); > + Assert.AreEqual("notkeyword", > tbl.GetQualifiedName(dialect, null, null)); > > tbl.Schema = "sch"; > > > Added: > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithDefault.hbm.xml > =================================================================== > --- > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithDefault.hbm.xml > (rev 0) > +++ > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithDefault.hbm.xml > 2008-12-16 18:39:12 UTC (rev 3958) > @@ -0,0 +1,13 @@ > +<?xml version="1.0" encoding="utf-8" ?> > +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > + > namespace="NHibernate.Test.NHSpecificTest.NH1443" > + assembly="NHibernate.Test" > + catalog="nhibernate" > + schema="dbo"> > + > + <class name="Aclass"> > + <id name="Id"> > + <generator class="native"/> > + </id> > + </class> > +</hibernate-mapping> > > Added: > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithNothing.hbm.xml > =================================================================== > --- > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithNothing.hbm.xml > (rev 0) > +++ > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithNothing.hbm.xml > 2008-12-16 18:39:12 UTC (rev 3958) > @@ -0,0 +1,11 @@ > +<?xml version="1.0" encoding="utf-8" ?> > +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > + > namespace="NHibernate.Test.NHSpecificTest.NH1443" > + assembly="NHibernate.Test"> > + > + <class name="Aclass"> > + <id name="Id"> > + <generator class="native"/> > + </id> > + </class> > +</hibernate-mapping> > > > Property changes on: > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithNothing.hbm.xml > ___________________________________________________________________ > Added: svn:mergeinfo > + > > Added: > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithSpecific.hbm.xml > =================================================================== > --- > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithSpecific.hbm.xml > (rev 0) > +++ > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithSpecific.hbm.xml > 2008-12-16 18:39:12 UTC (rev 3958) > @@ -0,0 +1,13 @@ > +<?xml version="1.0" encoding="utf-8" ?> > +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" > + > namespace="NHibernate.Test.NHSpecificTest.NH1443" > + assembly="NHibernate.Test" > + catalog="somethingDifferent" > + schema="somethingDifferent"> > + > + <class name="Aclass" catalog="nhibernate" schema="dbo"> > + <id name="Id"> > + <generator class="native"/> > + </id> > + </class> > +</hibernate-mapping> > > Added: > trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs > =================================================================== > --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs > (rev 0) > +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs > 2008-12-16 18:39:12 UTC (rev 3958) > @@ -0,0 +1,63 @@ > +using System.Text; > +using NHibernate.Cfg; > +using NHibernate.Tool.hbm2ddl; > +using NUnit.Framework; > +using NUnit.Framework.SyntaxHelpers; > + > +namespace NHibernate.Test.NHSpecificTest.NH1443 > +{ > + [TestFixture] > + public class Fixture > + { > + private static void Bug(Configuration cfg) > + { > + var su = new SchemaExport(cfg); > + var sb = new StringBuilder(500); > + su.Execute(x => sb.AppendLine(x), false, false, > true); > + string script = sb.ToString(); > + Assert.That(script, Text.Contains("drop table > nhibernate.dbo.Aclass")); > + Assert.That(script, Text.Contains("create table > nhibernate.dbo.Aclass")); > + } > + > + [Test] > + public void WithDefaultValuesInConfiguration() > + { > + Configuration cfg = > TestConfigurationHelper.GetDefaultConfiguration(); > + > cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithNothing.hbm.xml", > GetType().Assembly); > + cfg.SetProperty(Environment.DefaultCatalog, > "nhibernate"); > + cfg.SetProperty(Environment.DefaultSchema, "dbo"); > + Bug(cfg); > + } > + > + [Test] > + public void WithDefaultValuesInMapping() > + { > + Configuration cfg = > TestConfigurationHelper.GetDefaultConfiguration(); > + > cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithDefault.hbm.xml", > GetType().Assembly); > + Bug(cfg); > + } > + > + [Test] > + public void WithSpecificValuesInMapping() > + { > + Configuration cfg = > TestConfigurationHelper.GetDefaultConfiguration(); > + > cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithSpecific.hbm.xml", > GetType().Assembly); > + Bug(cfg); > + } > + > + [Test] > + public void > WithDefaultValuesInConfigurationPriorityToMapping() > + { > + Configuration cfg = > TestConfigurationHelper.GetDefaultConfiguration(); > + > cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithDefault.hbm.xml", > GetType().Assembly); > + cfg.SetProperty(Environment.DefaultCatalog, > "somethingDifferent"); > + cfg.SetProperty(Environment.DefaultSchema, > "somethingDifferent"); > + Bug(cfg); > + } > + } > + > + public class Aclass > + { > + public int Id { get; set; } > + } > +} > \ No newline at end of file > > Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj > =================================================================== > --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-16 > 16:17:49 UTC (rev 3957) > +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-16 > 18:39:12 UTC (rev 3958) > @@ -376,6 +376,7 @@ > <Compile Include="NHSpecificTest\NH1274ExportExclude\Home.cs" /> > <Compile > Include="NHSpecificTest\NH1274ExportExclude\NH1274ExportExcludeFixture.cs" > /> > <Compile Include="NHSpecificTest\NH1274ExportExclude\Person.cs" /> > + <Compile Include="NHSpecificTest\NH1443\Fixture.cs" /> > <Compile Include="NHSpecificTest\NH1611OneToOneIdentity\Adjunct.cs" /> > <Compile > Include="NHSpecificTest\NH1611OneToOneIdentity\NH1611OneToOneIdentityFixture.cs" > /> > <Compile Include="NHSpecificTest\NH1611OneToOneIdentity\Primary.cs" /> > @@ -1569,6 +1570,9 @@ > <EmbeddedResource Include="Cascade\JobBatch.hbm.xml" /> > <EmbeddedResource Include="Deletetransient\Person.hbm.xml" /> > <Content Include="DynamicEntity\package.html" /> > + <EmbeddedResource > Include="NHSpecificTest\NH1443\AclassWithSpecific.hbm.xml" /> > + <EmbeddedResource > Include="NHSpecificTest\NH1443\AclassWithDefault.hbm.xml" /> > + <EmbeddedResource > Include="NHSpecificTest\NH1443\AclassWithNothing.hbm.xml" /> > <EmbeddedResource > Include="NHSpecificTest\NH1274ExportExclude\Mappings.hbm.xml" /> > <EmbeddedResource > Include="NHSpecificTest\NH1611OneToOneIdentity\Mappings.hbm.xml" /> > <EmbeddedResource Include="NHSpecificTest\NH1533\Mappings.hbm.xml" /> > @@ -1669,4 +1673,4 @@ > if exist "$(ProjectDir)hibernate.cfg.xml" (copy > "$(ProjectDir)hibernate.cfg.xml" "hibernate.cfg.xml") > copy /y "..\..\..\NHibernate.DomainModel\ABC.hbm.xml" > "ABC.hbm.xml"</PostBuildEvent> > </PropertyGroup> > -</Project> > +</Project> > \ No newline at end of file > > > This was sent by the SourceForge.net collaborative development platform, > the world's largest Open Source development site. > > > ------------------------------------------------------------------------------ > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. > The future of the web can't happen without you. Join us at MIX09 to help > pave the way to the Next Web now. Learn more and register at > > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > _______________________________________________ > Nhibernate-commit mailing list > Nhi...@li... > https://lists.sourceforge.net/lists/listinfo/nhibernate-commit > -- Tuna Toksöz http://tunatoksoz.com Typos included to enhance the readers attention! |
From: <fab...@us...> - 2008-12-16 18:39:22
|
Revision: 3958 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3958&view=rev Author: fabiomaulo Date: 2008-12-16 18:39:12 +0000 (Tue, 16 Dec 2008) Log Message: ----------- - Fix NH-1443 - prevent another bug on PK Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs trunk/nhibernate/src/NHibernate/Mapping/PrimaryKey.cs trunk/nhibernate/src/NHibernate/Mapping/Table.cs trunk/nhibernate/src/NHibernate.Test/MappingTest/TableFixture.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithDefault.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithNothing.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithSpecific.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs Modified: trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2008-12-16 16:17:49 UTC (rev 3957) +++ trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2008-12-16 18:39:12 UTC (rev 3958) @@ -289,6 +289,7 @@ Table table = new DenormalizedTable(includedTable); table.IsAbstract = isAbstract; table.Name = name; + table.Catalog = catalog; table.Schema = schema; table.Subselect = subselect; tables[key] = table; Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs 2008-12-16 16:17:49 UTC (rev 3957) +++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs 2008-12-16 18:39:12 UTC (rev 3958) @@ -44,6 +44,7 @@ private void SetMappingsProperties(HbmMapping mappingSchema) { mappings.SchemaName = mappingSchema.schema; + mappings.CatalogName = mappingSchema.catalog; mappings.DefaultCascade = mappingSchema.defaultcascade; mappings.DefaultAccess = mappingSchema.defaultaccess; mappings.DefaultLazy = mappingSchema.defaultlazy; Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs 2008-12-16 16:17:49 UTC (rev 3957) +++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs 2008-12-16 18:39:12 UTC (rev 3958) @@ -20,7 +20,7 @@ //TABLENAME string schema = classSchema.schema ?? mappings.SchemaName; - string catalog = mappings.CatalogName; //string catalog = classSchema.catalog ?? mappings.CatalogName; + string catalog = classSchema.catalog ?? mappings.CatalogName; string tableName = GetClassTableName(rootClass, classSchema); if (string.IsNullOrEmpty(tableName)) { Modified: trunk/nhibernate/src/NHibernate/Mapping/PrimaryKey.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Mapping/PrimaryKey.cs 2008-12-16 16:17:49 UTC (rev 3957) +++ trunk/nhibernate/src/NHibernate/Mapping/PrimaryKey.cs 2008-12-16 18:39:12 UTC (rev 3958) @@ -76,7 +76,7 @@ public override string SqlDropString(Dialect.Dialect dialect, string defaultCatalog, string defaultSchema) { string ifExists = dialect.GetIfExistsDropConstraint(Table, Name); - string drop = string.Format("alter table {0}{1}", Table.GetQualifiedName(dialect, defaultSchema), dialect.GetDropPrimaryKeyConstraintString(Name)); + string drop = string.Format("alter table {0}{1}", Table.GetQualifiedName(dialect, defaultCatalog, defaultSchema), dialect.GetDropPrimaryKeyConstraintString(Name)); string end = dialect.GetIfExistsDropConstraintEnd(Table, Name); return ifExists + Environment.NewLine + drop + Environment.NewLine + end; } Modified: trunk/nhibernate/src/NHibernate/Mapping/Table.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Mapping/Table.cs 2008-12-16 16:17:49 UTC (rev 3957) +++ trunk/nhibernate/src/NHibernate/Mapping/Table.cs 2008-12-16 18:39:12 UTC (rev 3958) @@ -118,14 +118,10 @@ /// Gets the schema qualified name of the Table using the specified qualifier /// </summary> /// <param name="dialect">The <see cref="Dialect"/> that knows how to Quote the Table name.</param> - /// <param name="defaultQualifier">The Qualifier to use when accessing the table.</param> + /// <param name="defaultCatalog">The catalog name.</param> + /// <param name="defaultSchema">The schema name.</param> /// <returns>A String representing the Qualified name.</returns> /// <remarks>If this were used with MSSQL it would return a dbo.table_name.</remarks> - public string GetQualifiedName(Dialect.Dialect dialect, string defaultQualifier) - { - return GetQualifiedName(dialect, null, defaultQualifier); - } - public virtual string GetQualifiedName(Dialect.Dialect dialect, string defaultCatalog, string defaultSchema) { if (!string.IsNullOrEmpty(subselect)) @@ -410,7 +406,7 @@ dialect.CreateTableString : dialect.CreateMultisetTableString) .Append(' ') - .Append(GetQualifiedName(dialect, defaultSchema)) + .Append(GetQualifiedName(dialect, defaultCatalog, defaultSchema)) .Append(" ("); bool identityColumn = idValue != null && idValue.IsIdentityColumn(dialect); Modified: trunk/nhibernate/src/NHibernate.Test/MappingTest/TableFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/MappingTest/TableFixture.cs 2008-12-16 16:17:49 UTC (rev 3957) +++ trunk/nhibernate/src/NHibernate.Test/MappingTest/TableFixture.cs 2008-12-16 18:39:12 UTC (rev 3958) @@ -20,9 +20,9 @@ Assert.AreEqual("[keyword]", tbl.GetQuotedName(dialect)); - Assert.AreEqual("dbo.[keyword]", tbl.GetQualifiedName(dialect, "dbo")); + Assert.AreEqual("dbo.[keyword]", tbl.GetQualifiedName(dialect, null, "dbo")); - Assert.AreEqual("[keyword]", tbl.GetQualifiedName(dialect, null)); + Assert.AreEqual("[keyword]", tbl.GetQualifiedName(dialect, null, null)); tbl.Schema = "sch"; @@ -39,9 +39,9 @@ Assert.AreEqual("notkeyword", tbl.GetQuotedName(dialect)); - Assert.AreEqual("dbo.notkeyword", tbl.GetQualifiedName(dialect, "dbo")); + Assert.AreEqual("dbo.notkeyword", tbl.GetQualifiedName(dialect, null, "dbo")); - Assert.AreEqual("notkeyword", tbl.GetQualifiedName(dialect, null)); + Assert.AreEqual("notkeyword", tbl.GetQualifiedName(dialect, null, null)); tbl.Schema = "sch"; Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithDefault.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithDefault.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithDefault.hbm.xml 2008-12-16 18:39:12 UTC (rev 3958) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.NH1443" + assembly="NHibernate.Test" + catalog="nhibernate" + schema="dbo"> + + <class name="Aclass"> + <id name="Id"> + <generator class="native"/> + </id> + </class> +</hibernate-mapping> Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithNothing.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithNothing.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithNothing.hbm.xml 2008-12-16 18:39:12 UTC (rev 3958) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.NH1443" + assembly="NHibernate.Test"> + + <class name="Aclass"> + <id name="Id"> + <generator class="native"/> + </id> + </class> +</hibernate-mapping> Property changes on: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithNothing.hbm.xml ___________________________________________________________________ Added: svn:mergeinfo + Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithSpecific.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithSpecific.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/AclassWithSpecific.hbm.xml 2008-12-16 18:39:12 UTC (rev 3958) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.NH1443" + assembly="NHibernate.Test" + catalog="somethingDifferent" + schema="somethingDifferent"> + + <class name="Aclass" catalog="nhibernate" schema="dbo"> + <id name="Id"> + <generator class="native"/> + </id> + </class> +</hibernate-mapping> Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs 2008-12-16 18:39:12 UTC (rev 3958) @@ -0,0 +1,63 @@ +using System.Text; +using NHibernate.Cfg; +using NHibernate.Tool.hbm2ddl; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; + +namespace NHibernate.Test.NHSpecificTest.NH1443 +{ + [TestFixture] + public class Fixture + { + private static void Bug(Configuration cfg) + { + var su = new SchemaExport(cfg); + var sb = new StringBuilder(500); + su.Execute(x => sb.AppendLine(x), false, false, true); + string script = sb.ToString(); + Assert.That(script, Text.Contains("drop table nhibernate.dbo.Aclass")); + Assert.That(script, Text.Contains("create table nhibernate.dbo.Aclass")); + } + + [Test] + public void WithDefaultValuesInConfiguration() + { + Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration(); + cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithNothing.hbm.xml", GetType().Assembly); + cfg.SetProperty(Environment.DefaultCatalog, "nhibernate"); + cfg.SetProperty(Environment.DefaultSchema, "dbo"); + Bug(cfg); + } + + [Test] + public void WithDefaultValuesInMapping() + { + Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration(); + cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithDefault.hbm.xml", GetType().Assembly); + Bug(cfg); + } + + [Test] + public void WithSpecificValuesInMapping() + { + Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration(); + cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithSpecific.hbm.xml", GetType().Assembly); + Bug(cfg); + } + + [Test] + public void WithDefaultValuesInConfigurationPriorityToMapping() + { + Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration(); + cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1443.AclassWithDefault.hbm.xml", GetType().Assembly); + cfg.SetProperty(Environment.DefaultCatalog, "somethingDifferent"); + cfg.SetProperty(Environment.DefaultSchema, "somethingDifferent"); + Bug(cfg); + } + } + + public class Aclass + { + public int Id { get; set; } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-16 16:17:49 UTC (rev 3957) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-16 18:39:12 UTC (rev 3958) @@ -376,6 +376,7 @@ <Compile Include="NHSpecificTest\NH1274ExportExclude\Home.cs" /> <Compile Include="NHSpecificTest\NH1274ExportExclude\NH1274ExportExcludeFixture.cs" /> <Compile Include="NHSpecificTest\NH1274ExportExclude\Person.cs" /> + <Compile Include="NHSpecificTest\NH1443\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1611OneToOneIdentity\Adjunct.cs" /> <Compile Include="NHSpecificTest\NH1611OneToOneIdentity\NH1611OneToOneIdentityFixture.cs" /> <Compile Include="NHSpecificTest\NH1611OneToOneIdentity\Primary.cs" /> @@ -1569,6 +1570,9 @@ <EmbeddedResource Include="Cascade\JobBatch.hbm.xml" /> <EmbeddedResource Include="Deletetransient\Person.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1443\AclassWithSpecific.hbm.xml" /> + <EmbeddedResource Include="NHSpecificTest\NH1443\AclassWithDefault.hbm.xml" /> + <EmbeddedResource Include="NHSpecificTest\NH1443\AclassWithNothing.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1274ExportExclude\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1611OneToOneIdentity\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1533\Mappings.hbm.xml" /> @@ -1669,4 +1673,4 @@ if exist "$(ProjectDir)hibernate.cfg.xml" (copy "$(ProjectDir)hibernate.cfg.xml" "hibernate.cfg.xml") copy /y "..\..\..\NHibernate.DomainModel\ABC.hbm.xml" "ABC.hbm.xml"</PostBuildEvent> </PropertyGroup> -</Project> +</Project> \ 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...> - 2008-12-16 16:17:53
|
Revision: 3957 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3957&view=rev Author: fabiomaulo Date: 2008-12-16 16:17:49 +0000 (Tue, 16 Dec 2008) Log Message: ----------- Fix NH-1613 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs Modified: trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs 2008-12-16 15:39:36 UTC (rev 3956) +++ trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs 2008-12-16 16:17:49 UTC (rev 3957) @@ -43,7 +43,7 @@ /// </summary> /// <param name="cfg">The NHibernate Configuration to generate the schema from.</param> /// <param name="connectionProperties">The Properties to use when connecting to the Database.</param> - public SchemaExport(Configuration cfg, IDictionary<string,string> connectionProperties) + public SchemaExport(Configuration cfg, IDictionary<string, string> connectionProperties) { this.connectionProperties = connectionProperties; dialect = Dialect.Dialect.GetDialect(connectionProperties); @@ -87,6 +87,11 @@ Execute(script, export, false, true); } + public void Create(Action<string> scriptAction, bool export) + { + Execute(scriptAction, export, false, true); + } + /// <summary> /// Run the drop schema script /// </summary> @@ -101,8 +106,8 @@ Execute(script, export, true, true); } - private void Execute(bool script, bool export, bool format, bool throwOnError, TextWriter exportOutput, - IDbCommand statement, string sql) + private void Execute(Action<string> scriptAction, bool export, bool format, bool throwOnError, TextWriter exportOutput, + IDbCommand statement, string sql) { try { @@ -120,9 +125,9 @@ { formatted += delimiter; } - if (script) + if (scriptAction != null) { - Console.WriteLine(formatted); + scriptAction(formatted); } log.Debug(formatted); if (exportOutput != null) @@ -165,8 +170,21 @@ /// It does NOT close the given connection! /// </remarks> public void Execute(bool script, bool export, bool justDrop, bool format, - IDbConnection connection, TextWriter exportOutput) + IDbConnection connection, TextWriter exportOutput) { + if (script) + { + Execute(Console.WriteLine, export, justDrop, format, connection, exportOutput); + } + else + { + Execute(null, export, justDrop, format, connection, exportOutput); + } + } + + public void Execute(Action<string> scriptAction, bool export, bool justDrop, bool format, + IDbConnection connection, TextWriter exportOutput) + { IDbCommand statement = null; if (export && connection == null) @@ -182,14 +200,14 @@ { for (int i = 0; i < dropSQL.Length; i++) { - Execute(script, export, format, false, exportOutput, statement, dropSQL[i]); + Execute(scriptAction, export, format, false, exportOutput, statement, dropSQL[i]); } if (!justDrop) { for (int j = 0; j < createSQL.Length; j++) { - Execute(script, export, format, true, exportOutput, statement, createSQL[j]); + Execute(scriptAction, export, format, true, exportOutput, statement, createSQL[j]); } } } @@ -218,8 +236,10 @@ } } } + } + /// <summary> /// Executes the Export of the Schema. /// </summary> @@ -232,6 +252,17 @@ /// </remarks> public void Execute(bool script, bool export, bool justDrop, bool format) { + if (script) + { + Execute(Console.WriteLine, export, justDrop, format); + } + else + { + Execute(null, export, justDrop, format); + } + } + public void Execute(Action<string> scriptAction, bool export, bool justDrop, bool format) + { IDbConnection connection = null; StreamWriter fileOutput = null; IConnectionProvider connectionProvider = null; @@ -263,7 +294,7 @@ connection = connectionProvider.GetConnection(); } - Execute(script, export, justDrop, format, connection, fileOutput); + Execute(scriptAction, export, justDrop, format, connection, fileOutput); } catch (HibernateException) { @@ -283,6 +314,7 @@ connectionProvider.Dispose(); } } + } /// <summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2008-12-16 15:39:43
|
Revision: 3956 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3956&view=rev Author: fabiomaulo Date: 2008-12-16 15:39:36 +0000 (Tue, 16 Dec 2008) Log Message: ----------- - Fixed problem with NH-1593 test - starting fix NH-1613 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaUpdate.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/Fixture.cs Modified: trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaUpdate.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaUpdate.cs 2008-12-16 04:26:06 UTC (rev 3955) +++ trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaUpdate.cs 2008-12-16 15:39:36 UTC (rev 3956) @@ -11,7 +11,7 @@ public class SchemaUpdate { - private static readonly ILog log = LogManager.GetLogger(typeof (SchemaUpdate)); + private static readonly ILog log = LogManager.GetLogger(typeof(SchemaUpdate)); private readonly IConnectionHelper connectionHelper; private readonly Configuration configuration; private readonly Dialect.Dialect dialect; @@ -80,7 +80,7 @@ else if (args[i].StartsWith("--naming=")) { cfg.SetNamingStrategy( - (INamingStrategy) Activator.CreateInstance(ReflectHelper.ClassForName(args[i].Substring(9))) + (INamingStrategy)Activator.CreateInstance(ReflectHelper.ClassForName(args[i].Substring(9))) ); } } @@ -112,6 +112,23 @@ /// </summary> public void Execute(bool script, bool doUpdate) { + if (script) + { + Execute(Console.WriteLine, doUpdate); + } + else + { + Execute(null, doUpdate); + } + } + + /// <summary> + /// Execute the schema updates + /// </summary> + /// <param name="scriptAction">The action to write the each schema line.</param> + /// <param name="doUpdate">Commit the script to DB</param> + public void Execute(Action<string> scriptAction, bool doUpdate) + { log.Info("Running hbm2ddl schema update"); DbConnection connection; @@ -145,9 +162,9 @@ string sql = createSQL[j]; try { - if (script) + if (scriptAction != null) { - Console.WriteLine(sql); + scriptAction(sql); } if (doUpdate) { Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/Fixture.cs 2008-12-16 04:26:06 UTC (rev 3955) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/Fixture.cs 2008-12-16 15:39:36 UTC (rev 3956) @@ -1,13 +1,9 @@ -using System.Collections; -using System.Data.Common; -using System.Data.SqlClient; -using System.Reflection; - +using System.Text; using NHibernate.Cfg; -using NHibernate.Dialect; using NHibernate.Tool.hbm2ddl; using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; namespace NHibernate.Test.NHSpecificTest.NH1593 { @@ -17,35 +13,12 @@ [Test] public void SchemaUpdateAddsIndexesThatWerentPresentYet() { - Configuration cfg = new Configuration(); - Assembly assembly = Assembly.GetExecutingAssembly(); - cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1593.TestIndex.hbm.xml", assembly); - cfg.Configure(); - - // TODO: rewrite this so we don't need to open a session just to get a reference to a DbConnection (because that's the only reason the Session is used) - var sessionFactory = cfg.BuildSessionFactory(); - using (ISession session = sessionFactory.OpenSession()) - { - MsSql2005Dialect dialect = new MsSql2005Dialect(); - - DatabaseMetadata databaseMetaData = new DatabaseMetadata((DbConnection)session.Connection, dialect); - string[] script = cfg.GenerateSchemaUpdateScript(dialect, databaseMetaData); - - Assert.That(ScriptContainsIndexCreationLine(script)); - } + Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration(); + cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1593.TestIndex.hbm.xml", GetType().Assembly); + var su = new SchemaUpdate(cfg); + var sb = new StringBuilder(500); + su.Execute(x => sb.AppendLine(x), false); + Assert.That(sb.ToString(), Text.Contains("create index test_index_name on TestIndex (Name)")); } - - private bool ScriptContainsIndexCreationLine(string[] script) - { - foreach (string s in script) - { - if (s.Equals("create index test_index_name on TestIndex (Name)")) - { - return true; - } - } - - return false; - } } } \ 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: Wissing R. <res...@gr...> - 2008-12-16 08:57:58
|
Give woman the first thing she expects from yyou - the unforgetable pleasure http://cid-5ba42806ec407fdf.spaces.live.com/blog/cns!5BA42806EC407FDF!106.entry Ever known, was looking at him out of eyes as a house in london. During the war he worked for direction), and another eastsoutheast, which seemed a few minutes' rest is given to the camels, then low gabbling and whistling sound, which filled. |
From: <fab...@us...> - 2008-12-16 04:26:13
|
Revision: 3955 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3955&view=rev Author: fabiomaulo Date: 2008-12-16 04:26:06 +0000 (Tue, 16 Dec 2008) Log Message: ----------- Fix NH-1595 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2008-12-15 23:37:40 UTC (rev 3954) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2008-12-16 04:26:06 UTC (rev 3955) @@ -1,5 +1,6 @@ using System.Data; using System.Text; +using NHibernate.Dialect.Function; using NHibernate.SqlCommand; using NHibernate.Util; using System.Data.Common; @@ -44,6 +45,13 @@ RegisterColumnType(DbType.Time, "DATETIME"); RegisterColumnType(DbType.Boolean, "INTEGER"); RegisterColumnType(DbType.Guid, "UNIQUEIDENTIFIER"); + + RegisterFunction("second", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%S\", ?1)")); + RegisterFunction("minute", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%M\", ?1)")); + RegisterFunction("hour", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%H\", ?1)")); + RegisterFunction("day", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%d\", ?1)")); + RegisterFunction("month", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%m\", ?1)")); + RegisterFunction("year", new SQLFunctionTemplate(NHibernateUtil.Int32, "strftime(\"%Y\", ?1)")); } public override Schema.IDataBaseSchema GetDataBaseSchema(DbConnection connection) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wo...@us...> - 2008-12-15 23:37:49
|
Revision: 3954 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3954&view=rev Author: woil Date: 2008-12-15 23:37:40 +0000 (Mon, 15 Dec 2008) Log Message: ----------- Fixes NH 1611, NH 1274. 1611 is an uncommon one-to-one mapping issue. 1274 fills requests for schema-action="none|drop|export|update|validate|all" Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/JoinedSubclassBinder.cs trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs trunk/nhibernate/src/NHibernate/Mapping/Table.cs trunk/nhibernate/src/NHibernate/Type/OneToOneType.cs trunk/nhibernate/src/NHibernate/nhibernate-mapping.xsd trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/Home.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/Mappings.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/NH1274ExportExcludeFixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/Person.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1611OneToOneIdentity/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1611OneToOneIdentity/Adjunct.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1611OneToOneIdentity/Mappings.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1611OneToOneIdentity/NH1611OneToOneIdentityFixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1611OneToOneIdentity/Primary.cs trunk/nhibernate/src/NHibernate.Tool.HbmXsd/How to generate Hbm.generated.cs.txt Modified: trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2008-12-14 18:17:04 UTC (rev 3953) +++ trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2008-12-15 23:37:40 UTC (rev 3954) @@ -671,11 +671,11 @@ { foreach (var table in TableMappings) { - if (table.IsPhysicalTable) + if (table.IsPhysicalTable && table.SchemaDrop) { foreach (var fk in table.ForeignKeyIterator) { - if (fk.HasPhysicalConstraint) + if (fk.HasPhysicalConstraint && fk.ReferencedTable.SchemaDrop) { script.Add(fk.SqlDropString(dialect, defaultCatalog, defaultSchema)); } @@ -686,7 +686,7 @@ foreach (var table in TableMappings) { - if (table.IsPhysicalTable) + if (table.IsPhysicalTable && table.SchemaDrop) { script.Add(table.SqlDropString(dialect, defaultCatalog, defaultSchema)); } @@ -723,7 +723,7 @@ foreach (var table in TableMappings) { - if (table.IsPhysicalTable) + if (table.IsPhysicalTable && table.SchemaExport) { script.Add(table.SqlCreateString(dialect, mapping, defaultCatalog, defaultSchema)); script.AddRange(table.SqlCommentStrings(dialect, defaultCatalog, defaultSchema)); @@ -732,7 +732,7 @@ foreach (var table in TableMappings) { - if (table.IsPhysicalTable) + if (table.IsPhysicalTable && table.SchemaExport) { if (!dialect.SupportsUniqueConstraintInCreateAlterTable) { @@ -755,7 +755,7 @@ { foreach (var fk in table.ForeignKeyIterator) { - if (fk.HasPhysicalConstraint) + if (fk.HasPhysicalConstraint && fk.ReferencedTable.SchemaExport) { script.Add(fk.SqlCreateString(dialect, mapping, defaultCatalog, defaultSchema)); } @@ -790,6 +790,7 @@ foreach (var clazz in classes.Values) { clazz.Validate(mapping); + if (validateProxy) { ICollection<string> errors = ValidateProxyInterface(clazz, pvalidator); @@ -1919,7 +1920,7 @@ var script = new List<string>(50); foreach (var table in TableMappings) { - if (table.IsPhysicalTable) + if (table.IsPhysicalTable && table.SchemaUpdate) { ITableMetadata tableInfo = databaseMetadata.GetTableMetadata(table.Name, table.Schema ?? defaultSchema, table.Catalog ?? defaultCatalog, table.IsQuoted); @@ -1940,7 +1941,7 @@ foreach (var table in TableMappings) { - if (table.IsPhysicalTable) + if (table.IsPhysicalTable && table.SchemaUpdate) { ITableMetadata tableInfo = databaseMetadata.GetTableMetadata(table.Name, table.Schema, table.Catalog, table.IsQuoted); @@ -1949,7 +1950,7 @@ { foreach (var fk in table.ForeignKeyIterator) { - if (fk.HasPhysicalConstraint) + if (fk.HasPhysicalConstraint && fk.ReferencedTable.SchemaUpdate) { bool create = tableInfo == null || @@ -1999,7 +2000,7 @@ var iter = this.TableMappings; foreach (var table in iter) { - if (table.IsPhysicalTable) + if (table.IsPhysicalTable && table.SchemaValidate) { /*NH Different Implementation : TableMetadata tableInfo = databaseMetadata.getTableMetadata( Modified: trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs 2008-12-14 18:17:04 UTC (rev 3953) +++ trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/Hbm.generated.cs 2008-12-15 23:37:40 UTC (rev 3954) @@ -2,7 +2,7 @@ /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -83,7 +83,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -110,7 +110,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -128,7 +128,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -193,7 +193,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -207,7 +207,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -372,7 +372,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -386,7 +386,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -413,7 +413,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCacheUsage { @@ -436,7 +436,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCacheInclude { @@ -451,7 +451,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -465,7 +465,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -524,7 +524,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmOndelete { @@ -539,7 +539,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -565,7 +565,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -586,7 +586,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -618,7 +618,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -632,7 +632,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -770,7 +770,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -784,7 +784,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmOuterJoinStrategy { @@ -803,7 +803,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmFetchMode { @@ -818,7 +818,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmLaziness { @@ -837,7 +837,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmNotFoundMode { @@ -852,7 +852,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -888,7 +888,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1005,7 +1005,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1023,7 +1023,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1041,7 +1041,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPropertyGeneration { @@ -1060,7 +1060,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1121,7 +1121,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1151,7 +1151,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1255,7 +1255,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1277,7 +1277,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmRestrictedLaziness { @@ -1292,7 +1292,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1329,7 +1329,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1343,7 +1343,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1373,7 +1373,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCustomSQLCheck { @@ -1392,7 +1392,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCollectionFetchMode { @@ -1411,7 +1411,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1591,7 +1591,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCollectionLazy { @@ -1610,7 +1610,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1729,6 +1729,10 @@ public bool lazySpecified; /// <remarks/> + [System.Xml.Serialization.XmlAttributeAttribute("schema-action")] + public string schemaaction; + + /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] public string table; @@ -1825,7 +1829,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1847,7 +1851,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmTuplizerEntitymode { @@ -1866,7 +1870,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1916,7 +1920,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -1966,7 +1970,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2011,7 +2015,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmUnsavedValueType { @@ -2030,7 +2034,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2082,7 +2086,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2100,7 +2104,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2154,7 +2158,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2181,7 +2185,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2266,7 +2270,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2330,7 +2334,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2515,7 +2519,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2709,7 +2713,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2728,7 +2732,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2747,7 +2751,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2773,7 +2777,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2803,7 +2807,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2838,7 +2842,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2873,7 +2877,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -2966,7 +2970,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3108,7 +3112,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPrimitivearrayOuterjoin { @@ -3127,7 +3131,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPrimitivearrayFetch { @@ -3146,7 +3150,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3330,7 +3334,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3383,7 +3387,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmTimestampUnsavedvalue { @@ -3398,7 +3402,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmTimestampSource { @@ -3413,7 +3417,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmVersionGeneration { @@ -3428,7 +3432,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3462,7 +3466,7 @@ /// <remarks/> [System.Xml.Serialization.XmlAttributeAttribute()] - [System.ComponentModel.DefaultValueAttribute("integer")] + [System.ComponentModel.DefaultValueAttribute("Int32")] public string type; /// <remarks/> @@ -3483,13 +3487,13 @@ public bool insertSpecified; public HbmVersion() { - this.type = "integer"; + this.type = "Int32"; this.generated = HbmVersionGeneration.Never; } } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3672,7 +3676,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3705,7 +3709,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3757,7 +3761,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -3833,7 +3837,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:nhibernate-mapping-2.2")] public enum HbmJoinFetch { @@ -3848,7 +3852,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4009,7 +4013,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4030,7 +4034,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4061,7 +4065,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4083,7 +4087,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4097,7 +4101,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmLockMode { @@ -4124,7 +4128,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4163,7 +4167,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4177,7 +4181,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4208,7 +4212,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4226,7 +4230,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4301,7 +4305,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4319,7 +4323,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmFlushMode { @@ -4338,7 +4342,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmCacheMode { @@ -4365,7 +4369,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4455,7 +4459,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4594,7 +4598,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4752,7 +4756,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmPolymorphismType { @@ -4767,7 +4771,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:nhibernate-mapping-2.2")] public enum HbmOptimisticLockMode { @@ -4790,7 +4794,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4804,7 +4808,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4824,7 +4828,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4838,7 +4842,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4852,7 +4856,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4870,7 +4874,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4896,7 +4900,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -4914,7 +4918,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -5003,7 +5007,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -5025,7 +5029,7 @@ } /// <remarks/> - [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.0.0.1001")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("HbmXsd", "2.1.0.1001")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] Modified: trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2008-12-14 18:17:04 UTC (rev 3953) +++ trunk/nhibernate/src/NHibernate/Cfg/Mappings.cs 2008-12-15 23:37:40 UTC (rev 3954) @@ -246,7 +246,7 @@ } } - public Table AddTable(string schema, string catalog, string name, string subselect, bool isAbstract) + public Table AddTable(string schema, string catalog, string name, string subselect, bool isAbstract, string schemaAction) { string key = subselect ?? dialect.Qualify(catalog, schema, name); Table table; @@ -258,6 +258,10 @@ table.Schema = schema; table.Catalog = catalog; table.Subselect = subselect; + table.SchemaDrop = SchemaActionRequested(schemaAction, "drop"); + table.SchemaUpdate = SchemaActionRequested(schemaAction, "update"); + table.SchemaExport = SchemaActionRequested(schemaAction, "export"); + table.SchemaValidate = SchemaActionRequested(schemaAction, "validate"); tables[key] = table; } else @@ -269,6 +273,11 @@ return table; } + private static bool SchemaActionRequested(string schemaAction, string check) + { + return string.IsNullOrEmpty(schemaAction) || schemaAction.Contains("all") || schemaAction.Contains(check); + } + public Table AddDenormalizedTable(string schema, string catalog, string name, bool isAbstract, string subselect, Table includedTable) { string key = subselect ?? dialect.Qualify(schema, catalog, name); Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs 2008-12-14 18:17:04 UTC (rev 3953) +++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/ClassBinder.cs 2008-12-15 23:37:40 UTC (rev 3954) @@ -308,7 +308,10 @@ XmlAttribute catalogNode = node.Attributes["catalog"]; string catalog = catalogNode == null ? mappings.CatalogName : catalogNode.Value; - Table table = mappings.AddTable(schema, catalog, GetClassTableName(persistentClass, node), null, false); + XmlAttribute actionNode = node.Attributes["schema-action"]; + string action = actionNode == null ? "all" : actionNode.Value; + + Table table = mappings.AddTable(schema, catalog, GetClassTableName(persistentClass, node), null, false, action); join.Table = table; XmlAttribute fetchNode = node.Attributes["fetch"]; Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs 2008-12-14 18:17:04 UTC (rev 3953) +++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs 2008-12-15 23:37:40 UTC (rev 3954) @@ -196,7 +196,10 @@ XmlAttribute catalogNode = node.Attributes["catalog"]; string catalog = catalogNode == null ? mappings.CatalogName : catalogNode.Value; - model.CollectionTable = mappings.AddTable(schema, catalog, tableName, null, false); + XmlAttribute actionNode = node.Attributes["schema-action"]; + string action = actionNode == null ? "all" : actionNode.Value; + + model.CollectionTable = mappings.AddTable(schema, catalog, tableName, null, false, action); log.InfoFormat("Mapping collection: {0} -> {1}", model.Role, model.CollectionTable.Name); } Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/JoinedSubclassBinder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/JoinedSubclassBinder.cs 2008-12-14 18:17:04 UTC (rev 3953) +++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/JoinedSubclassBinder.cs 2008-12-15 23:37:40 UTC (rev 3954) @@ -39,7 +39,10 @@ XmlAttribute catalogNode = subnode.Attributes["catalog"]; string catalog = catalogNode == null ? mappings.CatalogName : catalogNode.Value; - Table mytable = mappings.AddTable(schema, catalog, GetClassTableName(subclass, subnode), null, false); + XmlAttribute actionNode = subnode.Attributes["schema-action"]; + string action = actionNode == null ? "all" : actionNode.Value; + + Table mytable = mappings.AddTable(schema, catalog, GetClassTableName(subclass, subnode), null, false, action); ((ITableOwner)subclass).Table = mytable; log.InfoFormat("Mapping joined-subclass: {0} -> {1}", subclass.EntityName, subclass.Table.Name); Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs 2008-12-14 18:17:04 UTC (rev 3953) +++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/RootClassBinder.cs 2008-12-15 23:37:40 UTC (rev 3954) @@ -30,7 +30,7 @@ rootClass.EntityName)); } - Table table = mappings.AddTable(schema, catalog, tableName, null, rootClass.IsAbstract.GetValueOrDefault()); + Table table = mappings.AddTable(schema, catalog, tableName, null, rootClass.IsAbstract.GetValueOrDefault(), classSchema.schemaaction); ((ITableOwner) rootClass).Table = table; log.InfoFormat("Mapping class: {0} -> {1}", rootClass.EntityName, rootClass.Table.Name); Modified: trunk/nhibernate/src/NHibernate/Mapping/Table.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Mapping/Table.cs 2008-12-14 18:17:04 UTC (rev 3953) +++ trunk/nhibernate/src/NHibernate/Mapping/Table.cs 2008-12-15 23:37:40 UTC (rev 3954) @@ -84,7 +84,12 @@ private string subselect; private string rowId; private bool isSchemaQuoted; + private bool schemaDrop = true; + private bool schemaUpdate = true; + private bool schemaExport = true; + private bool schemaValidate = true; + /// <summary> /// Initializes a new instance of <see cref="Table"/>. /// </summary> @@ -923,6 +928,30 @@ get { return !IsSubselect && !IsAbstractUnionTable; } } + public bool SchemaDrop + { + get { return schemaDrop; } + set { schemaDrop = value; } + } + + public bool SchemaUpdate + { + get { return schemaUpdate; } + set { schemaUpdate = value; } + } + + public bool SchemaExport + { + get { return schemaExport; } + set { schemaExport = value; } + } + + public bool SchemaValidate + { + get { return schemaValidate; } + set { schemaValidate = value; } + } + public string RowId { get { return rowId; } Modified: trunk/nhibernate/src/NHibernate/Type/OneToOneType.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Type/OneToOneType.cs 2008-12-14 18:17:04 UTC (rev 3953) +++ trunk/nhibernate/src/NHibernate/Type/OneToOneType.cs 2008-12-15 23:37:40 UTC (rev 3954) @@ -91,7 +91,24 @@ public override object Hydrate(IDataReader rs, string[] names, ISessionImplementor session, object owner) { - return session.GetContextEntityIdentifier(owner); + IType type = GetIdentifierOrUniqueKeyType(session.Factory); + object identifier = session.GetContextEntityIdentifier(owner); + + //This ugly mess is only used when mapping one-to-one entities with component ID types + EmbeddedComponentType componentType = type as EmbeddedComponentType; + if (componentType != null) + { + EmbeddedComponentType ownerIdType = session.GetEntityPersister(null, owner).IdentifierType as EmbeddedComponentType; + if (ownerIdType != null) + { + object[] values = ownerIdType.GetPropertyValues(identifier, session); + object id = componentType.ResolveIdentifier(values, session, null); + IEntityPersister persister = session.Factory.GetEntityPersister(type.ReturnedClass.FullName); + var key = new EntityKey(id, persister, session.EntityMode); + return session.PersistenceContext.GetEntity(key); + } + } + return identifier; } public override bool IsNullable Modified: trunk/nhibernate/src/NHibernate/nhibernate-mapping.xsd =================================================================== --- trunk/nhibernate/src/NHibernate/nhibernate-mapping.xsd 2008-12-14 18:17:04 UTC (rev 3953) +++ trunk/nhibernate/src/NHibernate/nhibernate-mapping.xsd 2008-12-15 23:37:40 UTC (rev 3954) @@ -184,6 +184,7 @@ <xs:attribute name="proxy" type="xs:string" /> <xs:attribute name="lazy" type="xs:boolean"> </xs:attribute> + <xs:attribute name="schema-action" type="xs:string" /> <xs:attribute name="table" type="xs:string" /> <xs:attribute name="schema" type="xs:string" /> <xs:attribute name="catalog" type="xs:string" /> Property changes on: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude ___________________________________________________________________ Added: bugtraq:url + http://jira.nhibernate.org/browse/%BUGID% Added: bugtraq:logregex + NH-\d+ Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/Home.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/Home.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/Home.cs 2008-12-15 23:37:40 UTC (rev 3954) @@ -0,0 +1,51 @@ +namespace NHibernate.Test.NHSpecificTest.NH1274ExportExclude +{ + public class Home + { + private int id; + private int zip; + private string city; + + public Home() + { + + } + + public Home(string city, int zip) + { + this.city = city; + this.zip = zip; + } + + virtual public int Id + { + get { return id; } + set { id = value; } + } + + virtual public string City + { + get { return city; } + set { city = value; } + } + + virtual public int Zip + { + get { return zip; } + set { zip = value; } + } + } + + public class Home_Update : Home { public Home_Update() { } public Home_Update(string city, int zip) : base(city, zip) { } } + + public class Home_Export : Home { public Home_Export() { } public Home_Export(string city, int zip) : base(city, zip) { } } + + public class Home_Validate : Home { public Home_Validate() { } public Home_Validate(string city, int zip) : base(city, zip) { } } + + public class Home_Drop : Home { public Home_Drop() { } public Home_Drop(string city, int zip) : base(city, zip) { } } + + public class Home_None : Home {public Home_None() { } public Home_None(string city, int zip) : base(city, zip) { } } + + public class Home_All : Home {public Home_All() { } public Home_All(string city, int zip) : base(city, zip) { } } + +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/Mappings.hbm.xml 2008-12-15 23:37:40 UTC (rev 3954) @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1274ExportExclude"> + + <class name="Home_None" schema-action="none"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="City"/> + <property name="Zip"/> + </class> + + <class name="Home_Drop" schema-action="drop"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="City"/> + <property name="Zip"/> + </class> + + <class name="Home_Export" schema-action="export"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="City"/> + <property name="Zip"/> + </class> + + <class name="Home_Update" schema-action="update"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="City"/> + <property name="Zip"/> + </class> + + <class name="Home_Validate" schema-action="validate"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="City"/> + <property name="Zip"/> + </class> + + <class name="Home_All" schema-action="all"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="City"/> + <property name="Zip"/> + </class> + + <class name="Person"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="Name"/> + <many-to-one name="Home_Drop" column="Home_DropID" /> + <many-to-one name="Home_Export" column="Home_ExportID" /> + <many-to-one name="Home_Update" column="Home_UpdateID" /> + <many-to-one name="Home_Validate" column="Home_ValidateID" /> + </class> + + +</hibernate-mapping> \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/NH1274ExportExcludeFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/NH1274ExportExcludeFixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/NH1274ExportExcludeFixture.cs 2008-12-15 23:37:40 UTC (rev 3954) @@ -0,0 +1,118 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using NHibernate.Cfg; +using NHibernate.Criterion; +using NHibernate.Engine; +using NHibernate.Tool.hbm2ddl; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1274ExportExclude +{ + [TestFixture] + public class NH1274ExportExcludeFixture + { + + [Test] + public void SchemaExport_Drop_CreatesDropScript() + { + Configuration configuration = GetConfiguration(); + SchemaExport export = new SchemaExport(configuration); + TextWriter tw = new StringWriter(); + Console.SetOut(tw); + export.Drop(true, false); + string s = tw.ToString(); + Assert.IsTrue(s.Contains("drop table Home_Drop")); + Assert.IsTrue(s.Contains("drop table Home_All")); + } + + [Test] + public void SchemaExport_Export_CreatesExportScript() + { + Configuration configuration = GetConfiguration(); + SchemaExport export = new SchemaExport(configuration); + TextWriter tw = new StringWriter(); + Console.SetOut(tw); + export.Create(true, false); + string s = tw.ToString(); + Assert.IsTrue(s.Contains("drop table Home_Drop")); + Assert.IsTrue(s.Contains("drop table Home_All")); + Assert.IsTrue(s.Contains("create table Home_All")); + Assert.IsTrue(s.Contains("create table Home_Export")); + } + + [Test] + public void SchemaExport_Update_CreatesUpdateScript() + { + Configuration configuration = GetConfiguration(); + SchemaUpdate update = new SchemaUpdate(configu... [truncated message content] |
From: <dav...@us...> - 2008-12-14 18:17:06
|
Revision: 3953 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3953&view=rev Author: davybrion Date: 2008-12-14 18:17:04 +0000 (Sun, 14 Dec 2008) Log Message: ----------- fix for NH-1608 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Util/LRUMap.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1608/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1608/Fixture.cs Modified: trunk/nhibernate/src/NHibernate/Util/LRUMap.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Util/LRUMap.cs 2008-12-14 14:03:45 UTC (rev 3952) +++ trunk/nhibernate/src/NHibernate/Util/LRUMap.cs 2008-12-14 18:17:04 UTC (rev 3953) @@ -50,7 +50,7 @@ } set { - base[key] = value; + Add(key, value); } } @@ -68,7 +68,7 @@ } } - base.Add(key, value); + base[key] = value; } private void RemoveLRU() Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1608/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1608/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1608/Fixture.cs 2008-12-14 18:17:04 UTC (rev 3953) @@ -0,0 +1,33 @@ +using NHibernate.Util; + +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; + +namespace NHibernate.Test.NHSpecificTest.NH1608 +{ + [TestFixture] + public class Fixture + { + [Test] + public void AddDoesBoundsChecking() + { + var map = new LRUMap(128); + + for (int i = 0; i < 200; i++) + map.Add("str" + i, i); + + Assert.That(map.Count, Is.EqualTo(128)); + } + + [Test] + public void IndexerDoesBoundsChecking() + { + var map = new LRUMap(128); + + for (int i = 0; i < 200; i++) + map["str" + i] = i; + + Assert.That(map.Count, Is.EqualTo(128)); + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-14 14:03:45 UTC (rev 3952) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-14 18:17:04 UTC (rev 3953) @@ -542,6 +542,7 @@ <Compile Include="NHSpecificTest\NH1593\TestIndex.cs" /> <Compile Include="NHSpecificTest\NH1594\A.cs" /> <Compile Include="NHSpecificTest\NH1594\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1608\Fixture.cs" /> <Compile Include="NHSpecificTest\NH280\Fixture.cs" /> <Compile Include="NHSpecificTest\NH280\Foo.cs" /> <Compile Include="NHSpecificTest\NH1018\Employee.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <te...@us...> - 2008-12-14 14:03:47
|
Revision: 3952 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3952&view=rev Author: tehlike Date: 2008-12-14 14:03:45 +0000 (Sun, 14 Dec 2008) Log Message: ----------- Adding more test for NH-1552 Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs 2008-12-14 11:11:54 UTC (rev 3951) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs 2008-12-14 14:03:45 UTC (rev 3952) @@ -23,7 +23,13 @@ { MyClass newServ = new MyClass(); newServ.Name = "tuna"; + MyClass newServ2 = new MyClass(); + newServ2.Name = "sidar"; + MyClass newServ3 = new MyClass(); + newServ3.Name = "berker"; session.Save(newServ); + session.Save(newServ2); + session.Save(newServ3); tran.Commit(); } } @@ -41,21 +47,61 @@ } [Test] - public void Paging_with_sql_works_as_expected() + public void Paging_with_sql_works_as_expected_with_FirstResult() { using (var session = this.OpenSession()) { using (var tran = session.BeginTransaction()) { - string sql = "select * from MyClass"; - IList list = session.CreateSQLQuery(sql) + string sql = "select * from MyClass order by Name asc"; + IList<MyClass> list = session.CreateSQLQuery(sql) .AddEntity(typeof(MyClass)) - .SetFirstResult(0) - .SetMaxResults(50) - .List(); - Assert.That(list.Count, Is.EqualTo(1)); + .SetFirstResult(1) + .List<MyClass>(); + Assert.That(list.Count, Is.EqualTo(2)); + Assert.That(list[0].Name, Is.EqualTo("sidar")); + Assert.That(list[1].Name, Is.EqualTo("tuna")); } } } + + [Test] + public void Paging_with_sql_works_as_expected_with_MaxResult() + { + using (var session = this.OpenSession()) + { + using (var tran = session.BeginTransaction()) + { + string sql = "select * from MyClass order by Name asc"; + IList<MyClass> list = session.CreateSQLQuery(sql) + .AddEntity(typeof(MyClass)) + .SetMaxResults(2) + .List<MyClass>(); + Assert.That(list.Count, Is.EqualTo(2)); + Assert.That(list[0].Name, Is.EqualTo("berker")); + Assert.That(list[1].Name, Is.EqualTo("sidar")); + } + } + } + + + [Test] + public void Paging_with_sql_works_as_expected_with_FirstResultMaxResult() + { + using (var session = this.OpenSession()) + { + using (var tran = session.BeginTransaction()) + { + string sql = "select * from MyClass"; + IList<MyClass> list = session.CreateSQLQuery(sql) + .AddEntity(typeof(MyClass)) + .SetFirstResult(1) + .SetMaxResults(1) + .List<MyClass>(); + Assert.That(list.Count, Is.EqualTo(1)); + Assert.That(list[0].Name, Is.EqualTo("sidar")); + } + } + } } } \ 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: <te...@us...> - 2008-12-14 11:11:56
|
Revision: 3951 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3951&view=rev Author: tehlike Date: 2008-12-14 11:11:54 +0000 (Sun, 14 Dec 2008) Log Message: ----------- Adding Dialect checkfor a test. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs 2008-12-13 22:06:37 UTC (rev 3950) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs 2008-12-14 11:11:54 UTC (rev 3951) @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Text; +using NHibernate.Dialect; using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; @@ -10,6 +11,10 @@ [TestFixture] public class Fixture : BugTestCase { + protected override bool AppliesTo(NHibernate.Dialect.Dialect dialect) + { + return dialect is MsSql2005Dialect; + } protected override void OnSetUp() { using (var session = this.OpenSession()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <te...@us...> - 2008-12-13 22:06:44
|
Revision: 3950 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3950&view=rev Author: tehlike Date: 2008-12-13 22:06:37 +0000 (Sat, 13 Dec 2008) Log Message: ----------- Fix for NH-1607 by Chaviv Weinberg with some modifications to increase readability Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Impl/SessionFactoryObjectFactory.cs Modified: trunk/nhibernate/src/NHibernate/Impl/SessionFactoryObjectFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Impl/SessionFactoryObjectFactory.cs 2008-12-12 15:56:00 UTC (rev 3949) +++ trunk/nhibernate/src/NHibernate/Impl/SessionFactoryObjectFactory.cs 2008-12-13 22:06:37 UTC (rev 3950) @@ -21,7 +21,7 @@ /// TODO: verify that the AppDomain statements are correct. /// </para> /// </remarks> - public sealed class SessionFactoryObjectFactory + public static class SessionFactoryObjectFactory { // to stop this class from being unloaded - this is a comment // from h2.0.3 - is this applicable to .net also??? @@ -38,11 +38,6 @@ log.Debug("initializing class SessionFactoryObjectFactory"); } - private SessionFactoryObjectFactory() - { - // should not be created - } - /// <summary> /// Adds an Instance of the SessionFactory to the local "cache". /// </summary> @@ -82,10 +77,8 @@ if (!string.IsNullOrEmpty(name)) { log.Info("unbinding factory: " + name); - NamedInstances.Remove(name); } - Instances.Remove(uid); } @@ -97,8 +90,9 @@ public static ISessionFactory GetNamedInstance(string name) { log.Debug("lookup: name=" + name); - ISessionFactory factory = NamedInstances[name]; - if (factory == null) + ISessionFactory factory; + bool found=NamedInstances.TryGetValue(name, out factory); + if (!found) { log.Warn("Not found: " + name); } @@ -113,8 +107,9 @@ public static ISessionFactory GetInstance(string uid) { log.Debug("lookup: uid=" + uid); - ISessionFactory factory = Instances[uid]; - if (factory == null) + ISessionFactory factory; + bool found = Instances.TryGetValue(uid, out factory); + if (!found) { log.Warn("Not found: " + uid); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: T. T. <te...@gm...> - 2008-12-13 22:00:37
|
Davy, one more thing I noticed while i was in jira. Hashtable returns null when a key is not found, but a dictionary throws KeyNotFoundException. [Fact] public void Dictionary_throws_exception_when_key_not_found() { IDictionary<string, string> dictionary = new Dictionary<string, string>(); Assert.Throws<KeyNotFoundException>(delegate { var v = dictionary["dummykey"]; }); } [Fact] public void Hashtable_returns_null_when_key_not_found() { Hashtable hashTable=new Hashtable(); Assert.Null(hashTable["dummykey"]); } On Mon, Nov 24, 2008 at 9:31 PM, <dav...@us...> wrote: > + private IDictionary<string, ArrayList> > parameterValueArrayHashTable; > + private IDictionary<string, bool> > parameterIsAllNullsHashTable; > -- Tuna Toksöz http://tunatoksoz.com Typos included to enhance the readers attention! |
From: <te...@us...> - 2008-12-12 15:56:08
|
Revision: 3949 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3949&view=rev Author: tehlike Date: 2008-12-12 15:56:00 +0000 (Fri, 12 Dec 2008) Log Message: ----------- Fixing a typo in a test for NH-1533 and fix the broken build. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Fixture.cs 2008-12-12 15:39:14 UTC (rev 3948) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Fixture.cs 2008-12-12 15:56:00 UTC (rev 3949) @@ -96,7 +96,7 @@ Assert.That(results.Count, Is.EqualTo(3)); Assert.That(((IList)results[0])[0], Is.EqualTo("Fred")); Assert.That(((IList)results[1])[0], Is.EqualTo("Tim")); - Assert.That(((IList)results[1])[0], Is.EqualTo("Mike")); + Assert.That(((IList)results[2])[0], Is.EqualTo("Mike")); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <te...@us...> - 2008-12-12 15:39:20
|
Revision: 3948 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3948&view=rev Author: tehlike Date: 2008-12-12 15:39:14 +0000 (Fri, 12 Dec 2008) Log Message: ----------- Added tests to support NH-1533 is not an issue (also not an issue before new 2005 dialect) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Mappings.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Person.cs Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Fixture.cs 2008-12-12 15:39:14 UTC (rev 3948) @@ -0,0 +1,104 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; + +namespace NHibernate.Test.NHSpecificTest.NH1533 +{ + [TestFixture] + public class Fixture:BugTestCase + { + protected override void OnTearDown() + { + base.OnTearDown(); + using (ISession session = OpenSession()) + { + using (ITransaction tx = session.BeginTransaction()) + { + session.Delete("from Person"); + tx.Commit(); + } + } + } + protected override void OnSetUp() + { + using (ISession s = OpenSession()) + { + using (ITransaction tx = s.BeginTransaction()) + { + Person e1 = new Person("Joe", 10, 9); + Person e2 = new Person("Sally", 10, 8); + Person e3 = new Person("Tim", 20, 40); //20 + Person e4 = new Person("Fred", 20, 7); + Person e5 = new Person("Mike", 50, 50); + s.Save(e1); + s.Save(e2); + s.Save(e3); + s.Save(e4); + s.Save(e5); + tx.Commit(); + } + } + } + + [Test] + public void Can_query_using_two_orderby_and_limit_altogether() + { + using(var sess=OpenSession()) + { + using(var tran=sess.BeginTransaction() ) + { + var query = + sess.CreateQuery( + "select this.Name,this.ShoeSize,this.IQ from Person as this order by this.IQ asc,this.ShoeSize asc"); + query.SetMaxResults(2); + query.SetFirstResult(2); + IList results = query.List(); + Assert.That(results.Count, Is.EqualTo(2)); + Assert.That(((IList)results[0])[0], Is.EqualTo("Fred")); + Assert.That(((IList)results[1])[0], Is.EqualTo("Tim")); + } + } + } + [Test] + public void Can_query_using_two_orderby_and_limit_with_maxresult_only() + { + using (var sess = OpenSession()) + { + using (var tran = sess.BeginTransaction()) + { + var query = + sess.CreateQuery( + "select this.Name,this.ShoeSize,this.IQ from Person as this order by this.IQ asc,this.ShoeSize asc"); + query.SetMaxResults(2); + IList results = query.List(); + Assert.That(results.Count, Is.EqualTo(2)); + Assert.That(((IList)results[0])[0], Is.EqualTo("Sally")); + Assert.That(((IList)results[1])[0], Is.EqualTo("Joe")); + } + } + } + + [Test] + public void Can_query_using_two_orderby_and_limit_with_firstresult_only() + { + using (var sess = OpenSession()) + { + using (var tran = sess.BeginTransaction()) + { + var query = + sess.CreateQuery( + "select this.Name,this.ShoeSize,this.IQ from Person as this order by this.IQ asc,this.ShoeSize asc"); + query.SetFirstResult(2); + IList results = query.List(); + Assert.That(results.Count, Is.EqualTo(3)); + Assert.That(((IList)results[0])[0], Is.EqualTo("Fred")); + Assert.That(((IList)results[1])[0], Is.EqualTo("Tim")); + Assert.That(((IList)results[1])[0], Is.EqualTo("Mike")); + } + } + } + } +} Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Mappings.hbm.xml 2008-12-12 15:39:14 UTC (rev 3948) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1533"> + + <class name="Person" lazy="false"> + <id name="Id"> + <generator class="native" /> + </id> + <property name="Name"/> + <property name="IQ"/> + <property name="ShoeSize"/> + </class> +</hibernate-mapping> \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Person.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Person.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1533/Person.cs 2008-12-12 15:39:14 UTC (rev 3948) @@ -0,0 +1,54 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using ArrayList=System.Collections.ArrayList; + +namespace NHibernate.Test.NHSpecificTest.NH1533 +{ + public class Person + { + private int id; + private int iq; + private string name; + private IList pets; + private int shoeSize; + + public Person() + { + pets = new ArrayList(); + } + + public Person(string name, int iq, int shoeSize) + { + this.name = name; + this.iq = iq; + this.shoeSize = shoeSize; + pets = new ArrayList(); + } + + public virtual int Id + { + get { return id; } + set { id = value; } + } + + public virtual string Name + { + get { return name; } + set { name = value; } + } + + public virtual int IQ + { + get { return iq; } + set { iq = value; } + } + + public virtual int ShoeSize + { + get { return shoeSize; } + set { shoeSize = value; } + } + } +} Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-12 15:00:59 UTC (rev 3947) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-12 15:39:14 UTC (rev 3948) @@ -521,6 +521,8 @@ <Compile Include="NHSpecificTest\NH1508\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1508\Person.cs" /> <Compile Include="NHSpecificTest\NH1515\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1533\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1533\Person.cs" /> <Compile Include="NHSpecificTest\NH1552\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1552\MyClass.cs" /> <Compile Include="NHSpecificTest\NH1556\Claim.cs" /> @@ -1560,6 +1562,7 @@ <EmbeddedResource Include="Cascade\JobBatch.hbm.xml" /> <EmbeddedResource Include="Deletetransient\Person.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1533\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1552\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1349\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1593\TestIndex.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <te...@us...> - 2008-12-12 15:01:04
|
Revision: 3947 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3947&view=rev Author: tehlike Date: 2008-12-12 15:00:59 +0000 (Fri, 12 Dec 2008) Log Message: ----------- Added tests to support NH-1552 is no longer an issue after applying NH-1603(MSSQL 2005 Paging patch) Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Mappings.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/MyClass.cs Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Fixture.cs 2008-12-12 15:00:59 UTC (rev 3947) @@ -0,0 +1,56 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; + +namespace NHibernate.Test.NHSpecificTest.NH1552 +{ + [TestFixture] + public class Fixture : BugTestCase + { + protected override void OnSetUp() + { + using (var session = this.OpenSession()) + { + using (var tran = session.BeginTransaction()) + { + MyClass newServ = new MyClass(); + newServ.Name = "tuna"; + session.Save(newServ); + tran.Commit(); + } + } + } + protected override void OnTearDown() + { + using (var session = this.OpenSession()) + { + using (var tran = session.BeginTransaction()) + { + session.Delete("from MyClass"); + tran.Commit(); + } + } + } + + [Test] + public void Paging_with_sql_works_as_expected() + { + using (var session = this.OpenSession()) + { + using (var tran = session.BeginTransaction()) + { + string sql = "select * from MyClass"; + IList list = session.CreateSQLQuery(sql) + .AddEntity(typeof(MyClass)) + .SetFirstResult(0) + .SetMaxResults(50) + .List(); + Assert.That(list.Count, Is.EqualTo(1)); + } + } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/Mappings.hbm.xml 2008-12-12 15:00:59 UTC (rev 3947) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1552"> + + <class name="MyClass"> + <id name="Id"> + <generator class="native"/> + </id> + <property name="Name"/> + </class> +</hibernate-mapping> \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/MyClass.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/MyClass.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1552/MyClass.cs 2008-12-12 15:00:59 UTC (rev 3947) @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace NHibernate.Test.NHSpecificTest.NH1552 +{ + public class MyClass + { + public virtual int Id { get; set; } + public virtual string Name { get; set; } + } +} Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-12 14:57:17 UTC (rev 3946) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-12 15:00:59 UTC (rev 3947) @@ -521,6 +521,8 @@ <Compile Include="NHSpecificTest\NH1508\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1508\Person.cs" /> <Compile Include="NHSpecificTest\NH1515\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1552\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1552\MyClass.cs" /> <Compile Include="NHSpecificTest\NH1556\Claim.cs" /> <Compile Include="NHSpecificTest\NH1556\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1556\Patient.cs" /> @@ -1558,6 +1560,7 @@ <EmbeddedResource Include="Cascade\JobBatch.hbm.xml" /> <EmbeddedResource Include="Deletetransient\Person.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1552\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1349\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1593\TestIndex.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1594\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <te...@us...> - 2008-12-12 14:57:23
|
Revision: 3946 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3946&view=rev Author: tehlike Date: 2008-12-12 14:57:17 +0000 (Fri, 12 Dec 2008) Log Message: ----------- Another proposal for MsSql2005 Paging issue, by Dana Naideth Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2008-12-12 14:40:38 UTC (rev 3945) +++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2005Dialect.cs 2008-12-12 14:57:17 UTC (rev 3946) @@ -29,12 +29,13 @@ /// The <c>LIMIT</c> SQL will look like /// <code> /// - /// SELECT TOP last (columns) FROM ( - /// SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_1__ {sort direction 1} [, __hibernate_sort_expr_2__ {sort direction 2}, ...]) as row, (query.columns) FROM ( - /// {original select query part}, {sort field 1} as __hibernate_sort_expr_1__ [, {sort field 2} as __hibernate_sort_expr_2__, ...] - /// {remainder of original query minus the order by clause} - /// ) query - /// ) page WHERE page.row > offset + /// SELECT + /// TOP last (columns) + /// FROM + /// (SELECT (columns), ROW_NUMBER() OVER(ORDER BY {original order by, with un-aliased column names) as __hibernate_sort_row + /// {original from}) as query + /// WHERE query.__hibernate_sort_row > offset + /// ORDER BY query.__hibernate_sort_row /// /// </code> /// @@ -76,58 +77,26 @@ { from = querySqlString.Substring(fromIndex).Trim(); // Use dummy sort to avoid errors - sortExpressions = new[] { new SqlString("CURRENT_TIMESTAMP"), }; + sortExpressions = new[] {new SqlString("CURRENT_TIMESTAMP"),}; } SqlStringBuilder result = - new SqlStringBuilder().Add("SELECT TOP ").Add(last.ToString()).Add(" ").Add(StringHelper.Join(", ", columnsOrAliases)) - .Add(" FROM (SELECT ROW_NUMBER() OVER(ORDER BY "); + new SqlStringBuilder() + .Add("SELECT TOP ") + .Add(last.ToString()) + .Add(" ") + .Add(StringHelper.Join(", ", columnsOrAliases)) + .Add(" FROM (") + .Add(select) + .Add(", ROW_NUMBER() OVER(ORDER BY "); - AppendSortExpressions(columnsOrAliases, sortExpressions, result); + AppendSortExpressions(aliasToColumn, sortExpressions, result); - result.Add(") as row, "); - - for (int i = 0; i < columnsOrAliases.Count; i++) - { - result.Add("query.").Add(columnsOrAliases[i]); - bool notLastColumn = i != columnsOrAliases.Count - 1; - if (notLastColumn) - { - result.Add(", "); - } - } - for (int i = 0; i < sortExpressions.Length; i++) - { - SqlString sortExpression = RemoveSortOrderDirection(sortExpressions[i]); - if (!columnsOrAliases.Contains(sortExpression)) - { - result.Add(", query.__hibernate_sort_expr_").Add(i.ToString()).Add("__"); - } - } - - result.Add(" FROM (").Add(select); - - for (int i = 0; i < sortExpressions.Length; i++) - { - SqlString sortExpression = RemoveSortOrderDirection(sortExpressions[i]); - - if (columnsOrAliases.Contains(sortExpression)) - { - continue; - } - - if (aliasToColumn.ContainsKey(sortExpression)) - { - sortExpression = aliasToColumn[sortExpression]; - } - - result.Add(", ").Add(sortExpression).Add(" as __hibernate_sort_expr_").Add(i.ToString()).Add("__"); - } - - result.Add(" ").Add(from).Add(") query ) page WHERE page.row > ").Add(offset.ToString()).Add(" ORDER BY "); - - AppendSortExpressions(columnsOrAliases, sortExpressions, result); - + result.Add(") as __hibernate_sort_row ") + .Add(from) + .Add(") as query WHERE query.__hibernate_sort_row > ") + .Add(offset.ToString()).Add(" ORDER BY query.__hibernate_sort_row"); + return result.ToSqlString(); } @@ -141,7 +110,7 @@ return trimmedExpression.Trim(); } - private static void AppendSortExpressions(ICollection<SqlString> columnsOrAliases, SqlString[] sortExpressions, + private static void AppendSortExpressions(Dictionary<SqlString, SqlString> aliasToColumn, SqlString[] sortExpressions, SqlStringBuilder result) { for (int i = 0; i < sortExpressions.Length; i++) @@ -152,13 +121,13 @@ } SqlString sortExpression = RemoveSortOrderDirection(sortExpressions[i]); - if (columnsOrAliases.Contains(sortExpression)) + if (aliasToColumn.ContainsKey(sortExpression)) { - result.Add(sortExpression); + result.Add(aliasToColumn[sortExpression]); } else { - result.Add("__hibernate_sort_expr_").Add(i.ToString()).Add("__"); + result.Add(sortExpression); } if (sortExpressions[i].Trim().EndsWithCaseInsensitive("desc")) { @@ -240,7 +209,7 @@ } columnsOrAliases.Add(new SqlString(alias)); - aliasToColumn[new SqlString(alias)] = new SqlString(token); + aliasToColumn[SqlString.Parse(alias)] = SqlString.Parse(token); } } @@ -443,3 +412,4 @@ } } } + Modified: trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs 2008-12-12 14:40:38 UTC (rev 3945) +++ trunk/nhibernate/src/NHibernate.Test/DialectTest/MsSql2005DialectFixture.cs 2008-12-12 14:57:17 UTC (rev 3946) @@ -16,55 +16,65 @@ MsSql2005Dialect d = new MsSql2005Dialect(); SqlString str = d.GetLimitString(new SqlString("select distinct c.Contact_Id as Contact1_19_0_, c._Rating as Rating2_19_0_ from dbo.Contact c where COALESCE(c.Rating, 0) > 0 order by c.Rating desc , c.Last_Name , c.First_Name"), 0, 10); + System.Console.WriteLine(str); Assert.AreEqual( - "SELECT TOP 10 Contact1_19_0_, Rating2_19_0_ FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__ DESC, __hibernate_sort_expr_1__, __hibernate_sort_expr_2__) as row, query.Contact1_19_0_, query.Rating2_19_0_, query.__hibernate_sort_expr_0__, query.__hibernate_sort_expr_1__, query.__hibernate_sort_expr_2__ FROM (select distinct c.Contact_Id as Contact1_19_0_, c._Rating as Rating2_19_0_, c.Rating as __hibernate_sort_expr_0__, c.Last_Name as __hibernate_sort_expr_1__, c.First_Name as __hibernate_sort_expr_2__ from dbo.Contact c where COALESCE(c.Rating, 0) > 0) query ) page WHERE page.row > 0 ORDER BY __hibernate_sort_expr_0__ DESC, __hibernate_sort_expr_1__, __hibernate_sort_expr_2__", + "SELECT TOP 10 Contact1_19_0_, Rating2_19_0_ FROM (select distinct c.Contact_Id as Contact1_19_0_, c._Rating as Rating2_19_0_, ROW_NUMBER() OVER(ORDER BY c.Rating DESC, c.Last_Name, c.First_Name) as __hibernate_sort_row from dbo.Contact c where COALESCE(c.Rating, 0) > 0) as query WHERE query.__hibernate_sort_row > 0 ORDER BY query.__hibernate_sort_row", str.ToString()); str = d.GetLimitString(new SqlString("SELECT fish.id FROM fish"), 0, 10); + System.Console.WriteLine(str); Assert.AreEqual( - "SELECT TOP 10 id FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__) as row, query.id, query.__hibernate_sort_expr_0__ FROM (SELECT fish.id, CURRENT_TIMESTAMP as __hibernate_sort_expr_0__ FROM fish) query ) page WHERE page.row > 0 ORDER BY __hibernate_sort_expr_0__", + "SELECT TOP 10 id FROM (SELECT fish.id, ROW_NUMBER() OVER(ORDER BY CURRENT_TIMESTAMP) as __hibernate_sort_row FROM fish) as query WHERE query.__hibernate_sort_row > 0 ORDER BY query.__hibernate_sort_row", str.ToString()); str = d.GetLimitString(new SqlString("SELECT DISTINCT fish_.id FROM fish fish_"), 0, 10); + System.Console.WriteLine(str); Assert.AreEqual( - "SELECT TOP 10 id FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__) as row, query.id, query.__hibernate_sort_expr_0__ FROM (SELECT DISTINCT fish_.id, CURRENT_TIMESTAMP as __hibernate_sort_expr_0__ FROM fish fish_) query ) page WHERE page.row > 0 ORDER BY __hibernate_sort_expr_0__", + "SELECT TOP 10 id FROM (SELECT DISTINCT fish_.id, ROW_NUMBER() OVER(ORDER BY CURRENT_TIMESTAMP) as __hibernate_sort_row FROM fish fish_) as query WHERE query.__hibernate_sort_row > 0 ORDER BY query.__hibernate_sort_row", str.ToString()); str = d.GetLimitString(new SqlString("SELECT DISTINCT fish_.id as ixx9_ FROM fish fish_"), 0, 10); + System.Console.WriteLine(str); Assert.AreEqual( - "SELECT TOP 10 ixx9_ FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__) as row, query.ixx9_, query.__hibernate_sort_expr_0__ FROM (SELECT DISTINCT fish_.id as ixx9_, CURRENT_TIMESTAMP as __hibernate_sort_expr_0__ FROM fish fish_) query ) page WHERE page.row > 0 ORDER BY __hibernate_sort_expr_0__", + "SELECT TOP 10 ixx9_ FROM (SELECT DISTINCT fish_.id as ixx9_, ROW_NUMBER() OVER(ORDER BY CURRENT_TIMESTAMP) as __hibernate_sort_row FROM fish fish_) as query WHERE query.__hibernate_sort_row > 0 ORDER BY query.__hibernate_sort_row", str.ToString()); str = d.GetLimitString(new SqlString("SELECT * FROM fish ORDER BY name"), 5, 15); + System.Console.WriteLine(str); Assert.AreEqual( - "SELECT TOP 15 * FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__) as row, query.*, query.__hibernate_sort_expr_0__ FROM (SELECT *, name as __hibernate_sort_expr_0__ FROM fish) query ) page WHERE page.row > 5 ORDER BY __hibernate_sort_expr_0__", + "SELECT TOP 15 * FROM (SELECT *, ROW_NUMBER() OVER(ORDER BY name) as __hibernate_sort_row FROM fish) as query WHERE query.__hibernate_sort_row > 5 ORDER BY query.__hibernate_sort_row", str.ToString()); str = d.GetLimitString(new SqlString("SELECT fish.id, fish.name FROM fish ORDER BY name DESC"), 7, 28); + System.Console.WriteLine(str); Assert.AreEqual( - "SELECT TOP 28 id, name FROM (SELECT ROW_NUMBER() OVER(ORDER BY name DESC) as row, query.id, query.name FROM (SELECT fish.id, fish.name FROM fish) query ) page WHERE page.row > 7 ORDER BY name DESC", + "SELECT TOP 28 id, name FROM (SELECT fish.id, fish.name, ROW_NUMBER() OVER(ORDER BY fish.name DESC) as __hibernate_sort_row FROM fish) as query WHERE query.__hibernate_sort_row > 7 ORDER BY query.__hibernate_sort_row", str.ToString()); str = d.GetLimitString( new SqlString("SELECT * FROM fish LEFT JOIN (SELECT * FROM meat ORDER BY weight) AS t ORDER BY name DESC"), 10, 20); + System.Console.WriteLine(str); Assert.AreEqual( - "SELECT TOP 20 * FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__ DESC) as row, query.*, query.__hibernate_sort_expr_0__ FROM (SELECT *, name as __hibernate_sort_expr_0__ FROM fish LEFT JOIN (SELECT * FROM meat ORDER BY weight) AS t) query ) page WHERE page.row > 10 ORDER BY __hibernate_sort_expr_0__ DESC", + "SELECT TOP 20 * FROM (SELECT *, ROW_NUMBER() OVER(ORDER BY name DESC) as __hibernate_sort_row FROM fish LEFT JOIN (SELECT * FROM meat ORDER BY weight) AS t) as query WHERE query.__hibernate_sort_row > 10 ORDER BY query.__hibernate_sort_row", str.ToString()); str = d.GetLimitString(new SqlString("SELECT *, (SELECT COUNT(1) FROM fowl WHERE fish_id = fish.id) AS some_count FROM fish"), 0, 10); + System.Console.WriteLine(str); Assert.AreEqual( - "SELECT TOP 10 *, some_count FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__) as row, query.*, query.some_count, query.__hibernate_sort_expr_0__ FROM (SELECT *, (SELECT COUNT(1) FROM fowl WHERE fish_id = fish.id) AS some_count, CURRENT_TIMESTAMP as __hibernate_sort_expr_0__ FROM fish) query ) page WHERE page.row > 0 ORDER BY __hibernate_sort_expr_0__", + "SELECT TOP 10 *, some_count FROM (SELECT *, (SELECT COUNT(1) FROM fowl WHERE fish_id = fish.id) AS some_count, ROW_NUMBER() OVER(ORDER BY CURRENT_TIMESTAMP) as __hibernate_sort_row FROM fish) as query WHERE query.__hibernate_sort_row > 0 ORDER BY query.__hibernate_sort_row", str.ToString()); str = d.GetLimitString(new SqlString("SELECT * FROM fish WHERE scales = ", Parameter.Placeholder), 0, 10); + System.Console.WriteLine(str); Assert.AreEqual( - "SELECT TOP 10 * FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__) as row, query.*, query.__hibernate_sort_expr_0__ FROM (SELECT *, CURRENT_TIMESTAMP as __hibernate_sort_expr_0__ FROM fish WHERE scales = ?) query ) page WHERE page.row > 0 ORDER BY __hibernate_sort_expr_0__", + "SELECT TOP 10 * FROM (SELECT *, ROW_NUMBER() OVER(ORDER BY CURRENT_TIMESTAMP) as __hibernate_sort_row FROM fish WHERE scales = ?) as query WHERE query.__hibernate_sort_row > 0 ORDER BY query.__hibernate_sort_row", str.ToString()); str = d.GetLimitString(new SqlString("SELECT f.Type, COUNT(DISTINCT f.Name) AS Name FROM Fish f GROUP BY f.Type ORDER BY COUNT(DISTINCT f.Name)"), 0, 10); + System.Console.WriteLine(str); Assert.AreEqual( - "SELECT TOP 10 Type, Name FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__) as row, query.Type, query.Name, query.__hibernate_sort_expr_0__ FROM (SELECT f.Type, COUNT(DISTINCT f.Name) AS Name, COUNT(DISTINCT f.Name) as __hibernate_sort_expr_0__ FROM Fish f GROUP BY f.Type) query ) page WHERE page.row > 0 ORDER BY __hibernate_sort_expr_0__", + "SELECT TOP 10 Type, Name FROM (SELECT f.Type, COUNT(DISTINCT f.Name) AS Name, ROW_NUMBER() OVER(ORDER BY COUNT(DISTINCT f.Name)) as __hibernate_sort_row FROM Fish f GROUP BY f.Type) as query WHERE query.__hibernate_sort_row > 0 ORDER BY query.__hibernate_sort_row", str.ToString()); } @@ -74,13 +84,15 @@ MsSql2005Dialect d = new MsSql2005Dialect(); SqlString result = d.GetLimitString(new SqlString("select concat(a.Description,', ', a.Description) as desc from Animal a"), 0, 10); - Assert.AreEqual("SELECT TOP 10 desc FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__) as row, query.desc, query.__hibernate_sort_expr_0__ FROM (select concat(a.Description,', ', a.Description) as desc, CURRENT_TIMESTAMP as __hibernate_sort_expr_0__ from Animal a) query ) page WHERE page.row > 0 ORDER BY __hibernate_sort_expr_0__", result.ToString()); + System.Console.WriteLine(result); + Assert.AreEqual("SELECT TOP 10 desc FROM (select concat(a.Description,', ', a.Description) as desc, ROW_NUMBER() OVER(ORDER BY CURRENT_TIMESTAMP) as __hibernate_sort_row from Animal a) as query WHERE query.__hibernate_sort_row > 0 ORDER BY query.__hibernate_sort_row", result.ToString()); // The test use the function "cast" because cast need the keyWork "as" too SqlString str = d.GetLimitString(new SqlString("SELECT fish.id, cast('astring, with,comma' as string) as bar FROM fish"), 0, 10); + System.Console.WriteLine(str); Assert.AreEqual( - "SELECT TOP 10 id, bar FROM (SELECT ROW_NUMBER() OVER(ORDER BY __hibernate_sort_expr_0__) as row, query.id, query.bar, query.__hibernate_sort_expr_0__ FROM (SELECT fish.id, cast('astring, with,comma' as string) as bar, CURRENT_TIMESTAMP as __hibernate_sort_expr_0__ FROM fish) query ) page WHERE page.row > 0 ORDER BY __hibernate_sort_expr_0__", + "SELECT TOP 10 id, bar FROM (SELECT fish.id, cast('astring, with,comma' as string) as bar, ROW_NUMBER() OVER(ORDER BY CURRENT_TIMESTAMP) as __hibernate_sort_row FROM fish) as query WHERE query.__hibernate_sort_row > 0 ORDER BY query.__hibernate_sort_row", str.ToString()); } [Test] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <te...@us...> - 2008-12-12 14:40:44
|
Revision: 3945 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3945&view=rev Author: tehlike Date: 2008-12-12 14:40:38 +0000 (Fri, 12 Dec 2008) Log Message: ----------- Added tests for NH1349 to support it is not an issue. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Mappings.hbm.xml trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Services.cs Property changes on: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349 ___________________________________________________________________ Added: svn:mergeinfo + Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Fixture.cs 2008-12-12 14:40:38 UTC (rev 3945) @@ -0,0 +1,56 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; + +namespace NHibernate.Test.NHSpecificTest.NH1349 +{ + [TestFixture] + public class Fixture : BugTestCase + { + protected override void OnSetUp() + { + using(var session=this.OpenSession()) + { + using(var tran=session.BeginTransaction()) + { + string name = "fabio"; + string accNum = DateTime.Now.Ticks.ToString(); ; + Services newServ = new Services(); + newServ.AccountNumber = accNum; + newServ.Name = name + " person"; + newServ.Type = (new Random()).Next(0, 9).ToString(); + + session.Save(newServ); + tran.Commit(); + } + } + } + protected override void OnTearDown() + { + using (var session = this.OpenSession()) + { + using (var tran = session.BeginTransaction()) + { + session.Delete("from Services"); + tran.Commit(); + } + } + } + + [Test] + public void Can_page_with_formula_property() + { + using (var session = this.OpenSession()) + { + using(var tran=session.BeginTransaction()) + { + IList ret = session.CreateCriteria(typeof(Services)).SetMaxResults(5).List(); //this breaks + Assert.That(ret.Count,Is.EqualTo(1)); + } + } + } + } +} Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Mappings.hbm.xml 2008-12-12 14:40:38 UTC (rev 3945) @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + namespace="NHibernate.Test.NHSpecificTest.NH1349" + assembly="NHibernate.Test"> + <class name="Services" table="services"> + <id name="Id" column="id" type="int"> + <generator class="increment" /> + </id> + <property name="AccountNumber" column="accountNumber" type="String" length="30"/> + <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%' )" + 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. + --> + </class> +</hibernate-mapping> \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Services.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Services.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1349/Services.cs 2008-12-12 14:40:38 UTC (rev 3945) @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace NHibernate.Test.NHSpecificTest.NH1349 +{ + public class Services + { + private int id; + private int companyCount; + private string accountNumber; + private string name; + private string type; + + public Services() + { } + + public virtual int Id + { + get { return id; } + set { id = value; } + } + + public virtual string AccountNumber + { + get { return accountNumber; } + set { accountNumber = value; } + } + public virtual string Name + { + get { return name; } + set { name = value; } + } + public virtual string Type + { + get { return type; } + set { type = value; } + } + public virtual int CompanyCount + { + get { return companyCount; } + set { companyCount = value; } + } + public virtual string ToString() + { + return (this.id + "] [" + this.accountNumber + "] [" + this.name + "] [" + this.type + "] [" + this.CompanyCount + "]"); + + } + } + +} Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-08 10:53:17 UTC (rev 3944) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-12 14:40:38 UTC (rev 3945) @@ -469,6 +469,8 @@ <Compile Include="NHSpecificTest\NH1332\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1347\A.cs" /> <Compile Include="NHSpecificTest\NH1347\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1349\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1349\Services.cs" /> <Compile Include="NHSpecificTest\NH1355\Category.cs" /> <Compile Include="NHSpecificTest\NH1355\CustomVersionType.cs" /> <Compile Include="NHSpecificTest\NH1355\UserTypeTimestamp.cs" /> @@ -1556,6 +1558,7 @@ <EmbeddedResource Include="Cascade\JobBatch.hbm.xml" /> <EmbeddedResource Include="Deletetransient\Person.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1349\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1593\TestIndex.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1594\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1579\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dav...@us...> - 2008-12-08 10:53:19
|
Revision: 3944 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3944&view=rev Author: davybrion Date: 2008-12-08 10:53:17 +0000 (Mon, 08 Dec 2008) Log Message: ----------- fix for NH-1593 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/TestIndex.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/TestIndex.hbm.xml Modified: trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2008-12-03 20:06:17 UTC (rev 3943) +++ trunk/nhibernate/src/NHibernate/Cfg/Configuration.cs 2008-12-08 10:53:17 UTC (rev 3944) @@ -1962,6 +1962,14 @@ } } } + + foreach (var index in table.IndexIterator) + { + if (tableInfo == null || tableInfo.GetIndexMetadata(index.Name) == null) + { + script.Add(index.SqlCreateString(dialect, mapping, defaultCatalog, defaultSchema)); + } + } } } Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/Fixture.cs 2008-12-08 10:53:17 UTC (rev 3944) @@ -0,0 +1,51 @@ +using System.Collections; +using System.Data.Common; +using System.Data.SqlClient; +using System.Reflection; + +using NHibernate.Cfg; +using NHibernate.Dialect; +using NHibernate.Tool.hbm2ddl; + +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1593 +{ + [TestFixture] + public class Fixture + { + [Test] + public void SchemaUpdateAddsIndexesThatWerentPresentYet() + { + Configuration cfg = new Configuration(); + Assembly assembly = Assembly.GetExecutingAssembly(); + cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1593.TestIndex.hbm.xml", assembly); + cfg.Configure(); + + // TODO: rewrite this so we don't need to open a session just to get a reference to a DbConnection (because that's the only reason the Session is used) + var sessionFactory = cfg.BuildSessionFactory(); + using (ISession session = sessionFactory.OpenSession()) + { + MsSql2005Dialect dialect = new MsSql2005Dialect(); + + DatabaseMetadata databaseMetaData = new DatabaseMetadata((DbConnection)session.Connection, dialect); + string[] script = cfg.GenerateSchemaUpdateScript(dialect, databaseMetaData); + + Assert.That(ScriptContainsIndexCreationLine(script)); + } + } + + private bool ScriptContainsIndexCreationLine(string[] script) + { + foreach (string s in script) + { + if (s.Equals("create index test_index_name on TestIndex (Name)")) + { + return true; + } + } + + return false; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/TestIndex.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/TestIndex.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/TestIndex.cs 2008-12-08 10:53:17 UTC (rev 3944) @@ -0,0 +1,20 @@ +namespace NHibernate.Test.NHSpecificTest.NH1593 +{ + public class TestIndex + { + private int id; + private string name; + + public int Id + { + get { return id; } + set { id = value; } + } + + public string Name + { + get { return name; } + set { name = value; } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/TestIndex.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/TestIndex.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1593/TestIndex.hbm.xml 2008-12-08 10:53:17 UTC (rev 3944) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NHibernate.Test.NHSpecificTest.NH1593" assembly="NHibernate.Test"> + <class name="TestIndex" lazy="false"> + <id name="Id"> + <generator class="native"/> + </id> + <property name="Name" index="test_index_name"/> + </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 2008-12-03 20:06:17 UTC (rev 3943) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-08 10:53:17 UTC (rev 3944) @@ -532,6 +532,8 @@ <Compile Include="NHSpecificTest\NH1579\Orange.cs" /> <Compile Include="NHSpecificTest\NH1587\A.cs" /> <Compile Include="NHSpecificTest\NH1587\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1593\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1593\TestIndex.cs" /> <Compile Include="NHSpecificTest\NH1594\A.cs" /> <Compile Include="NHSpecificTest\NH1594\Fixture.cs" /> <Compile Include="NHSpecificTest\NH280\Fixture.cs" /> @@ -1554,6 +1556,7 @@ <EmbeddedResource Include="Cascade\JobBatch.hbm.xml" /> <EmbeddedResource Include="Deletetransient\Person.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1593\TestIndex.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1594\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1579\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH298\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Twomey R. <fl...@ih...> - 2008-12-07 20:31:32
|
SShow your sweetheart how much you love her!!! http://cid-d3d2b0a79fec48cc.spaces.live.com/blog/cns!D3D2B0A79FEC48CC!106.entry Spirit had appeared to her two successive nights. Demean themselves and he that is too modest must with its full quota of sinister significance. And hold her there and expose her body and then across the street from it his father's store.. |
From: Debaets H. <app...@br...> - 2008-12-06 13:47:29
|
WOW! Santa Claus try our meds and fuck housewife and her daughtter! http://cid-6851449e3f7352b2.spaces.live.com/blog/cns!6851449E3F7352B2!106.entry Thy intellect is clouded at the approach of thy elephants and steeds. At the outset vast was the their attention, but they were insignificant compared do not know very much about her social intercourse they were too shy to go far up, though they jostled. |
From: <dav...@us...> - 2008-12-03 20:06:22
|
Revision: 3943 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3943&view=rev Author: davybrion Date: 2008-12-03 20:06:17 +0000 (Wed, 03 Dec 2008) Log Message: ----------- applied patch for NH-1593 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/A.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/Mappings.hbm.xml Modified: trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2008-12-03 19:45:12 UTC (rev 3942) +++ trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2008-12-03 20:06:17 UTC (rev 3943) @@ -408,7 +408,7 @@ /// <returns>The database type name used by ddl.</returns> public virtual string GetTypeName(SqlType sqlType) { - if (sqlType.LengthDefined) + if (sqlType.LengthDefined || sqlType.PrecisionDefined) { string resultWithLength = typeNames.Get(sqlType.DbType, sqlType.Length, sqlType.Precision, sqlType.Scale); if (resultWithLength != null) return resultWithLength; Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2008-12-03 19:45:12 UTC (rev 3942) +++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2008-12-03 20:06:17 UTC (rev 3943) @@ -65,6 +65,7 @@ // correctly with minimal work. RegisterColumnType(DbType.Decimal, "DECIMAL(19,5)"); RegisterColumnType(DbType.Decimal, 19, "DECIMAL(19, $l)"); + RegisterColumnType(DbType.Decimal, 19, "DECIMAL($p, $s)"); RegisterColumnType(DbType.Double, "DOUBLE PRECISION"); //synonym for FLOAT(53) RegisterColumnType(DbType.Guid, "UNIQUEIDENTIFIER"); RegisterColumnType(DbType.Int16, "SMALLINT"); Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/A.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/A.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/A.cs 2008-12-03 20:06:17 UTC (rev 3943) @@ -0,0 +1,7 @@ +namespace NHibernate.Test.NHSpecificTest.NH1594 +{ + public class A + { + public virtual decimal Foo { get; set; } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/Fixture.cs 2008-12-03 20:06:17 UTC (rev 3943) @@ -0,0 +1,28 @@ +using System.Reflection; +using NHibernate.Cfg; +using NHibernate.Dialect; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1594 +{ + [TestFixture] + public class Fixture + { + [Test] + public void Bug() + { + Configuration cfg = new Configuration(); + Assembly assembly = Assembly.GetExecutingAssembly(); + cfg.AddResource("NHibernate.Test.NHSpecificTest.NH1594.Mappings.hbm.xml", assembly); + + string[] script = cfg.GenerateSchemaCreationScript(new MsSql2000Dialect()); + + bool found = string.Compare( + script[0], + "create table A (id INT IDENTITY NOT NULL, Foo DECIMAL(4, 2) null, primary key (id))", + true) == 0; + + Assert.IsTrue(found, "when using decimal(precision,scale) Script should contain the correct create table statement"); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/Mappings.hbm.xml (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1594/Mappings.hbm.xml 2008-12-03 20:06:17 UTC (rev 3943) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8" ?> +<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" + assembly="NHibernate.Test" + namespace="NHibernate.Test.NHSpecificTest.NH1594"> + <class name="A"> + <id type="int"> + <generator class="native"/> + </id> + <property name="Foo" type="Decimal(4,2)" /> + </class> +</hibernate-mapping> Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-03 19:45:12 UTC (rev 3942) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2008-12-03 20:06:17 UTC (rev 3943) @@ -532,6 +532,8 @@ <Compile Include="NHSpecificTest\NH1579\Orange.cs" /> <Compile Include="NHSpecificTest\NH1587\A.cs" /> <Compile Include="NHSpecificTest\NH1587\Fixture.cs" /> + <Compile Include="NHSpecificTest\NH1594\A.cs" /> + <Compile Include="NHSpecificTest\NH1594\Fixture.cs" /> <Compile Include="NHSpecificTest\NH280\Fixture.cs" /> <Compile Include="NHSpecificTest\NH280\Foo.cs" /> <Compile Include="NHSpecificTest\NH1018\Employee.cs" /> @@ -1552,6 +1554,7 @@ <EmbeddedResource Include="Cascade\JobBatch.hbm.xml" /> <EmbeddedResource Include="Deletetransient\Person.hbm.xml" /> <Content Include="DynamicEntity\package.html" /> + <EmbeddedResource Include="NHSpecificTest\NH1594\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1579\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH298\Mappings.hbm.xml" /> <EmbeddedResource Include="NHSpecificTest\NH1587\Mappings.hbm.xml" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dav...@us...> - 2008-12-03 19:45:15
|
Revision: 3942 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3942&view=rev Author: davybrion Date: 2008-12-03 19:45:12 +0000 (Wed, 03 Dec 2008) Log Message: ----------- included patch from Robert Sosnowski for NH-1592 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/InformixDialect.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate/Dialect/InformixDialect0940.cs trunk/nhibernate/src/NHibernate/Dialect/InformixDialect1000.cs trunk/nhibernate/src/NHibernate/Exceptions/ReflectionBasedSqlStateExtracter.cs trunk/nhibernate/src/NHibernate/Exceptions/SqlStateExtracter.cs trunk/nhibernate/src/NHibernate/Exceptions/TemplatedViolatedConstraintNameExtracter.cs trunk/nhibernate/src/NHibernate/SqlCommand/InformixJoinFragment.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/InformixDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/InformixDialect.cs 2008-11-30 20:32:19 UTC (rev 3941) +++ trunk/nhibernate/src/NHibernate/Dialect/InformixDialect.cs 2008-12-03 19:45:12 UTC (rev 3942) @@ -1,101 +1,490 @@ using System.Data; -using NHibernate.Cfg; +using NHibernate.Dialect.Function; +using NHibernate.SqlCommand; +using System.Data.Common; +using NHibernate.Exceptions; +//using NHibernate.Dialect.Schema; +using Environment = NHibernate.Cfg.Environment; + namespace NHibernate.Dialect { - /// <summary> - /// Summary description for InformixDialect. - /// </summary> - /// <remarks> - /// The InformixDialect defaults the following configuration properties: - /// <list type="table"> - /// <listheader> - /// <term>Property</term> - /// <description>Default Value</description> - /// </listheader> - /// <item> - /// <term>connection.driver_class</term> - /// <description><see cref="NHibernate.Driver.OdbcDriver" /></description> - /// </item> - /// </list> - /// </remarks> - public class InformixDialect : Dialect - { - /// <summary></summary> - public InformixDialect() : base() - { -// registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) ); + /// <summary> + /// Summary description for InformixDialect. + /// This dialect is intended to work with IDS version 7.31 + /// However I can test only version 10.00 as I have only this version at work + /// </summary> + /// <remarks> + /// The InformixDialect defaults the following configuration properties: + /// <list type="table"> + /// <listheader> + /// <term>ConnectionDriver</term> + /// <description>NHibernate.Driver.OdbcDriver</description> + /// <term>PrepareSql</term> + /// <description>true</description> + /// </listheader> + /// <item> + /// <term>connection.driver_class</term> + /// <description><see cref="NHibernate.Driver.OdbcDriver" /></description> + /// </item> + /// </list> + /// </remarks> + public class InformixDialect : Dialect + { + /// <summary></summary> + public InformixDialect() + : base() + { + RegisterColumnType(DbType.AnsiStringFixedLength, "CHAR($l)"); + RegisterColumnType(DbType.AnsiString, 255, "VARCHAR($l)"); + RegisterColumnType(DbType.AnsiString, 32739, "LVARCHAR($l)"); + RegisterColumnType(DbType.AnsiString, 2147483647, "TEXT"); + RegisterColumnType(DbType.AnsiString, "VARCHAR(255)"); + RegisterColumnType(DbType.Binary, 2147483647, "BYTE"); + RegisterColumnType(DbType.Binary, "BYTE"); + RegisterColumnType(DbType.Boolean, "BOOLEAN"); + RegisterColumnType(DbType.Currency, "DECIMAL(16,4)"); + RegisterColumnType(DbType.Byte, "SMALLINT"); + RegisterColumnType(DbType.Date, "DATE"); + RegisterColumnType(DbType.DateTime, "datetime year to fraction(5)"); + RegisterColumnType(DbType.Decimal, "DECIMAL(19, 5)"); + RegisterColumnType(DbType.Decimal, 19, "DECIMAL($p, $s)"); + RegisterColumnType(DbType.Double, "DOUBLE"); + RegisterColumnType(DbType.Int16, "SMALLINT"); + RegisterColumnType(DbType.Int32, "INTEGER"); + RegisterColumnType(DbType.Int64, "BIGINT"); + RegisterColumnType(DbType.Single, "SmallFloat"); + RegisterColumnType(DbType.Time, "datetime hour to second"); + RegisterColumnType(DbType.StringFixedLength, "CHAR($l)"); + RegisterColumnType(DbType.String, 255, "VARCHAR($l)"); + RegisterColumnType(DbType.String, 32739, "LVARCHAR($l)"); + RegisterColumnType(DbType.String, 2147483647, "TEXT"); + RegisterColumnType(DbType.String, "VARCHAR(255)"); - RegisterColumnType(DbType.AnsiStringFixedLength, "CHAR($l)"); - RegisterColumnType(DbType.AnsiString, 255, "VARCHAR($l)"); - RegisterColumnType(DbType.AnsiString, 32739, "LVARCHAR($l)"); - RegisterColumnType(DbType.AnsiString, 2147483647, "CLOB"); - RegisterColumnType(DbType.AnsiString, "VARCHAR(255)"); - RegisterColumnType(DbType.Binary, 2147483647, "BLOB"); - RegisterColumnType(DbType.Binary, "BLOB"); - RegisterColumnType(DbType.Byte, "SMALLINT"); - RegisterColumnType(DbType.Date, "DATE"); - RegisterColumnType(DbType.DateTime, "datetime year to fraction(5)"); - RegisterColumnType(DbType.Decimal, "DECIMAL(19,5)"); - RegisterColumnType(DbType.Decimal, 19, "DECIMAL(19, $l)"); - RegisterColumnType(DbType.Double, "DOUBLE"); - RegisterColumnType(DbType.Int16, "SMALLINT"); - RegisterColumnType(DbType.Int32, "INTEGER"); - RegisterColumnType(DbType.Int64, "BIGINT"); - RegisterColumnType(DbType.Single, "SmallFloat"); - RegisterColumnType(DbType.Time, "datetime hour to second"); - RegisterColumnType(DbType.StringFixedLength, "CHAR($l)"); - RegisterColumnType(DbType.String, 255, "VARCHAR($l)"); - RegisterColumnType(DbType.String, 32739, "LVARCHAR($l)"); - RegisterColumnType(DbType.String, 2147483647, "CLOB"); - RegisterColumnType(DbType.String, "VARCHAR(255)"); + RegisterFunction("substring", new AnsiSubstringFunction()); // base class override + RegisterFunction("substr", new StandardSQLFunction("substr")); + // RegisterFunction("trim", new AnsiTrimFunction()); // defined in base class + // RegisterFunction("length", new StandardSQLFunction("length", NHibernateUtil.Int32)); // defined in base class + RegisterFunction("coalesce", new NvlFunction()); // base class override + // RegisterFunction("abs", new StandardSQLFunction("abs")); + // RegisterFunction("mod", new StandardSQLFunction("mod", NHibernateUtil.Int32)); + // RegisterFunction("sqrt", new StandardSQLFunction("sqrt", NHibernateUtil.Double)); + // RegisterFunction("upper", new StandardSQLFunction("upper")); + // RegisterFunction("lower", new StandardSQLFunction("lower")); + // RegisterFunction("cast", new CastFunction()); + // RegisterFunction("concat", new VarArgsSQLFunction(NHibernateUtil.String, "(", "||", ")")); + RegisterFunction("current_timestamp", new NoArgSQLFunction("current", NHibernateUtil.DateTime, false)); + RegisterFunction("sysdate", new NoArgSQLFunction("today", NHibernateUtil.DateTime, false)); + RegisterFunction("current", new NoArgSQLFunction("current", NHibernateUtil.DateTime, false)); + RegisterFunction("today", new NoArgSQLFunction("today", NHibernateUtil.DateTime, false)); + RegisterFunction("day", new StandardSQLFunction("day", NHibernateUtil.Int32)); + RegisterFunction("month", new StandardSQLFunction("month", NHibernateUtil.Int32)); + RegisterFunction("year", new StandardSQLFunction("year", NHibernateUtil.Int32)); + RegisterFunction("date", new StandardSQLFunction("date", NHibernateUtil.DateTime)); + RegisterFunction("mdy", new SQLFunctionTemplate(NHibernateUtil.DateTime, "mdy(?1, ?2, ?3)")); + RegisterFunction("to_char", new StandardSQLFunction("to_char", NHibernateUtil.String)); + RegisterFunction("to_date", new StandardSQLFunction("to_date", NHibernateUtil.Timestamp)); + RegisterFunction("instr", new StandardSQLFunction("instr", NHibernateUtil.String)); + // actually there is no Instr (or equivalent) in Informix; you have to write your own SPL or UDR - DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.OdbcDriver"; - } + DefaultProperties[Environment.ConnectionDriver] = "NHibernate.Driver.OdbcDriver"; + DefaultProperties[Environment.PrepareSql] = "true"; + } - /// <summary></summary> - public override string AddColumnString - { - get { return "add"; } - } + /// <summary> + /// The keyword used to insert a generated value into an identity column (or null). + /// Need if the dialect does not support inserts that specify no column values. + /// </summary> + public override string IdentityInsertString + { + get { return "0"; } + } - public override bool SupportsIdentityColumns - { - get { return true; } - } + /// <summary> Command used to create a temporary table. </summary> + public override string CreateTemporaryTableString + { + get { return "create temp table"; } + } - /// <summary> - /// The syntax that returns the identity value of the last insert, if native - /// key generation is supported - /// </summary> - public override string IdentitySelectString - { -// return type==Types.BIGINT ? -// "select dbinfo('serial8') from systables where tabid=1" : -// "select dbinfo('sqlca.sqlerrd1') from systables where tabid=1"; - get { return "select dbinfo('sqlca.sqlerrd1') from systables where tabid=1"; } - } + /// <summary> + /// Get any fragments needing to be postfixed to the command for + /// temporary table creation. + /// </summary> + public override string CreateTemporaryTablePostfix + { + get { return "with no log"; } + } + /// <summary> + /// Should the value returned by <see cref="CurrentTimestampSelectString"/> + /// be treated as callable. Typically this indicates that JDBC escape + /// sytnax is being used... + /// </summary> + public override bool IsCurrentTimestampSelectStringCallable + { + get { return true; } + } - /// <summary> - /// The keyword used to specify an identity column, if native key generation is supported - /// </summary> - public override string IdentityColumnString - { -// return type==Types.BIGINT ? -// "serial8 not null" : -// "serial not null"; - get { return "serial not null"; } - } + /// <summary> + /// Retrieve the command used to retrieve the current timestammp from the database. + /// </summary> + public override string CurrentTimestampSelectString + { + get { return "select current from systables where tabid=1"; } + } - /// <summary> - /// Whether this dialect have an Identity clause added to the data type or a - /// completely seperate identity data type - /// </summary> - public override bool HasDataTypeInIdentityColumn - { - get { return false; } - } - } + /// <summary> + /// The name of the database-specific SQL function for retrieving the + /// current timestamp. + /// </summary> + public override string CurrentTimestampSQLFunctionName + { + get { return "current"; } + } + + public override IViolatedConstraintNameExtracter ViolatedConstraintNameExtracter + { + get { return new IfxViolatedConstraintExtracter(); } + } + + /// <summary></summary> + public override string AddColumnString + { + get { return "add"; } + } + + //public override IDataBaseSchema GetDataBaseSchema(DbConnection connection) + //{ + // if (connection.ToString()=="IBM.Data.Informix.IfxConnection") { + // // this driver doesn't have working IfxConnection.GetSchema + // // and probably will never have + // throw new NotSupportedException(); + // } + // if (connection.ToString()=="System.Data.Odbc.OdbcConnection") { + // // waiting for somebody implementing OdbcBaseSchema + // // return new OdbcBaseSchema(connection); + // } + // if (connection.ToString()=="IBM.Data.DB2.IfxConnection") { + // // waiting for somebody implementing DB2BaseSchema + // return new DB2BaseSchema(connection); + // } + // throw new NotSupportedException(); + //} + + /// <summary> Is <tt>FOR UPDATE OF</tt> syntax supported? </summary> + /// <value> True if the database supports <tt>FOR UPDATE OF</tt> syntax; false otherwise. </value> + public override bool ForUpdateOfColumns + { + get { return true; } + } + + /// <summary> + /// Does this dialect support <tt>FOR UPDATE</tt> in conjunction with outer joined rows? + /// </summary> + /// <value> True if outer joined rows can be locked via <tt>FOR UPDATE</tt>. </value> + public override bool SupportsOuterJoinForUpdate + { + get { return false; } + } + + /// <summary> + /// Get the <tt>FOR UPDATE OF column_list</tt> fragment appropriate for this + /// dialect given the aliases of the columns to be write locked. + /// </summary> + /// <param name="aliases">The columns to be write locked. </param> + /// <returns> The appropriate <tt>FOR UPDATE OF column_list</tt> clause string. </returns> + public override string GetForUpdateString(string aliases) + { + return ForUpdateString + " of " + aliases; + } + + /// <summary> Does this dialect support temporary tables? </summary> + public override bool SupportsTemporaryTables + { + get { return true; } + } + + /// <summary> + /// Does the dialect require that temporary table DDL statements occur in + /// isolation from other statements? This would be the case if the creation + /// would cause any current transaction to get committed implicitly. + /// </summary> + /// <returns> see the result matrix above. </returns> + /// <remarks> + /// JDBC defines a standard way to query for this information via the + /// {@link java.sql.DatabaseMetaData#dataDefinitionCausesTransactionCommit()} + /// method. However, that does not distinguish between temporary table + /// DDL and other forms of DDL; MySQL, for example, reports DDL causing a + /// transaction commit via its driver, even though that is not the case for + /// temporary table DDL. + /// <p/> + /// Possible return values and their meanings:<ul> + /// <li>{@link Boolean#TRUE} - Unequivocally, perform the temporary table DDL in isolation.</li> + /// <li>{@link Boolean#FALSE} - Unequivocally, do <b>not</b> perform the temporary table DDL in isolation.</li> + /// <li><i>null</i> - defer to the JDBC driver response in regards to {@link java.sql.DatabaseMetaData#dataDefinitionCausesTransactionCommit()}</li> + /// </ul> + /// </remarks> + public override bool? PerformTemporaryTableDDLInIsolation() + { + return false; + } + + public override int RegisterResultSetOutParameter(DbCommand statement, int position) + { + return position; + } + + public override DbDataReader GetResultSet(DbCommand statement) + { + return statement.ExecuteReader(CommandBehavior.SingleResult); + } + + /// <summary> Does this dialect support a way to retrieve the database's current timestamp value? </summary> + public override bool SupportsCurrentTimestampSelection + { + get { return true; } + } + + public override long TimestampResolutionInTicks + { + get { return 100L; } // Maximum precision (one tick) + } + + public override bool SupportsIdentityColumns + { + get { return true; } + } + + /// <summary> + /// Whether this dialect have an Identity clause added to the data type or a + /// completely seperate identity data type + /// </summary> + public override bool HasDataTypeInIdentityColumn + { + get { return false; } + } + + /// <summary> + /// Get the select command to use to retrieve the last generated IDENTITY + /// value for a particular table + /// </summary> + /// <param name="tableName">The table into which the insert was done </param> + /// <param name="identityColumn">The PK column. </param> + /// <param name="type">The <see cref="DbType"/> type code. </param> + /// <returns> The appropriate select command </returns> + public override string GetIdentitySelectString(string identityColumn, string tableName, DbType type) + { + return type == DbType.Int64 ? + "select dbinfo('serial8') from systables where tabid=1" : + "select dbinfo('sqlca.sqlerrd1') from systables where tabid=1"; + } + + /// <summary> + /// The syntax that returns the identity value of the last insert, if native + /// key generation is supported + /// </summary> + public override string IdentitySelectString + { + // return type==Types.BIGINT ? + // "select dbinfo('serial8') from systables where tabid=1" : + // "select dbinfo('sqlca.sqlerrd1') from systables where tabid=1"; + get { return "select dbinfo('sqlca.sqlerrd1') from systables where tabid=1"; } + } + + /// <summary> + /// The syntax used during DDL to define a column as being an IDENTITY of + /// a particular type. + /// </summary> + /// <param name="type">The <see cref="DbType"/> type code. </param> + /// <returns> The appropriate DDL fragment. </returns> + public override string GetIdentityColumnString(DbType type) + { + return type == DbType.Int64 ? + "serial8 not null" : + "serial not null"; + } + + /// <summary> + /// The keyword used to specify an identity column, if native key generation is supported + /// </summary> + public override string IdentityColumnString + { + get { return "serial not null"; } + } + + /// <summary> + /// Does this dialect support sequences? + /// </summary> + public override bool SupportsSequences + { + get { return false; } + } + + /// <summary> + /// Create a <see cref="JoinFragment"/> strategy responsible + /// for handling this dialect's variations in how joins are handled. + /// </summary> + /// <returns> This dialect's <see cref="JoinFragment"/> strategy. </returns> + public override JoinFragment CreateOuterJoinFragment() + { + return new InformixJoinFragment(); + } + + /// <summary> The SQL literal value to which this database maps boolean values. </summary> + /// <param name="value">The boolean value </param> + /// <returns> The appropriate SQL literal. </returns> + public override string ToBooleanValueString(bool value) + { + return value ? "t" : "f"; + } + /// <summary> + /// Does this Dialect have some kind of <c>LIMIT</c> syntax? + /// </summary> + /// <value>False, unless overridden.</value> + public override bool SupportsLimit + { + // select first * is supported since 7.31 + // but it works with unions since 10.00 + // so it is safer to regard that it is not supported + get { return false; } + } + + /// <summary> + /// Does this Dialect support an offset? + /// </summary> + public override bool SupportsLimitOffset + { + get { return false; } + } + /// <summary> + /// Can parameters be used for a statement containing a LIMIT? + /// </summary> + public override bool SupportsVariableLimit + { + get { return false; } + } + /// <summary> + /// Does the <c>LIMIT</c> clause come at the start of the + /// <c>SELECT</c> statement rather than at the end? + /// </summary> + /// <value>false, unless overridden</value> + public override bool BindLimitParametersFirst + { + get { return true; } + } + + + /// <summary> Apply s limit clause to the query. </summary> + /// <param name="querySqlString">The query to which to apply the limit. </param> + /// <param name="hasOffset">Is the query requesting an offset? </param> + /// <returns> the modified SQL </returns> + /// <remarks> + /// Typically dialects utilize <see cref="SupportsVariableLimit"/> + /// limit caluses when they support limits. Thus, when building the + /// select command we do not actually need to know the limit or the offest + /// since we will just be using placeholders. + /// <p/> + /// Here we do still pass along whether or not an offset was specified + /// so that dialects not supporting offsets can generate proper exceptions. + /// In general, dialects will override one or the other of this method and + /// <see cref="GetLimitString(SqlString,int,int)"/>. + /// </remarks> + public override SqlString GetLimitString(SqlString querySqlString, int offset, int limit) + { + /* + * "SELECT [SKIP x] FIRST y rest-of-sql-statement" + */ + + int insertIndex = GetAfterSelectInsertPoint(querySqlString); + + if (offset > 0) + { + return querySqlString.Insert(insertIndex, " skip " + offset + " first " + limit); + } + + return querySqlString.Insert(insertIndex, " first " + limit); + } + /// <summary> + /// Does this dialect support UNION ALL, which is generally a faster variant of UNION? + /// True if UNION ALL is supported; false otherwise. + /// </summary> + public override bool SupportsUnionAll + { + get { return true; } + } + + public override bool SupportsEmptyInList + { + get { return false; } + } + + public override bool SupportsResultSetPositionQueryMethodsOnForwardOnlyCursor + { + get { return false; } + } + + public override bool DoesRepeatableReadCauseReadersToBlockWriters + { + get { return true; } + } + + public override ISQLExceptionConverter BuildSQLExceptionConverter() + { + // The default SQLExceptionConverter for all dialects is based on SQLState + // since SQLErrorCode is extremely vendor-specific. Specific Dialects + // may override to return whatever is most appropriate for that vendor. + return new SQLStateConverter(ViolatedConstraintNameExtracter); + } + + private static int GetAfterSelectInsertPoint(SqlString text) + { + if (text.StartsWithCaseInsensitive("select")) + { + return 6; + } + + return -1; + } + } + + public class IfxViolatedConstraintExtracter : TemplatedViolatedConstraintNameExtracter + { + /// <summary> + /// Extract the name of the violated constraint from the given DbException. + /// </summary> + /// <param name="sqle">The exception that was the result of the constraint violation.</param> + /// <returns>The extracted constraint name.</returns> + public override string ExtractConstraintName(DbException sqle) + { + string constraintName = null; + + ReflectionBasedSqlStateExtracter extracter = new ReflectionBasedSqlStateExtracter(); + + int errorCode = extracter.ExtractErrorCode(sqle); + if (errorCode == -268) + { + constraintName = ExtractUsingTemplate("Unique constraint (", ") violated.", sqle.Message); + } + else if (errorCode == -691) + { + constraintName = ExtractUsingTemplate("Missing key in referenced table for referential constraint (", ").", sqle.Message); + } + else if (errorCode == -692) + { + constraintName = ExtractUsingTemplate("Key value for constraint (", ") is still being referenced.", sqle.Message); + } + + if (constraintName != null) + { + // strip table-owner because Informix always returns constraint names as "<table-owner>.<constraint-name>" + int i = constraintName.IndexOf('.'); + if (i != -1) + { + constraintName = constraintName.Substring(i + 1); + } + } + return constraintName; + } + }; } \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Dialect/InformixDialect0940.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/InformixDialect0940.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Dialect/InformixDialect0940.cs 2008-12-03 19:45:12 UTC (rev 3942) @@ -0,0 +1,150 @@ +using System.Data; +using NHibernate.Cfg; +using NHibernate.Dialect.Function; +using NHibernate.SqlCommand; +using System.Data.Common; +using NHibernate.Exceptions; +using NHibernate.Util; +//using NHibernate.Dialect.Schema; +using Environment = NHibernate.Cfg.Environment; + + +namespace NHibernate.Dialect +{ + /// <summary> + /// Summary description for InformixDialect. + /// This dialect is intended to work with IDS version 9.40 + /// </summary> + /// <remarks> + /// The InformixDialect defaults the following configuration properties: + /// <list type="table"> + /// <listheader> + /// <term>ConnectionDriver</term> + /// <description>NHibernate.Driver.OdbcDriver</description> + /// <term>PrepareSql</term> + /// <description>true</description> + /// </listheader> + /// <item> + /// <term>connection.driver_class</term> + /// <description><see cref="NHibernate.Driver.OdbcDriver" /></description> + /// </item> + /// </list> + /// </remarks> + public class InformixDialect0940 : InformixDialect + { + /// <summary></summary> + public InformixDialect0940() + : base() + { + RegisterColumnType(DbType.AnsiString, 2147483647, "CLOB"); + RegisterColumnType(DbType.Binary, 2147483647, "BLOB"); + RegisterColumnType(DbType.Binary, "BLOB"); + RegisterColumnType(DbType.String, 2147483647, "CLOB"); + } + + + /// <summary> Get the select command used retrieve the names of all sequences.</summary> + /// <returns> The select command; or null if sequences are not supported. </returns> + public override string QuerySequencesString + { + get + { + return "select tabname from systables where tabtype='Q'"; + } + } + + /// <summary> + /// Does this dialect support sequences? + /// </summary> + public override bool SupportsSequences + { + get { return true; } + } + + /// <summary> + /// Does this dialect support "pooled" sequences. Not aware of a better + /// name for this. Essentially can we specify the initial and increment values? + /// </summary> + /// <returns> True if such "pooled" sequences are supported; false otherwise. </returns> + public override bool SupportsPooledSequences + { + get { return true; } + } + + /// <summary> + /// Generate the appropriate select statement to to retreive the next value + /// of a sequence. + /// </summary> + /// <param name="sequenceName">the name of the sequence </param> + /// <returns> String The "nextval" select string. </returns> + /// <remarks>This should be a "stand alone" select statement.</remarks> + public override string GetSequenceNextValString(string sequenceName) + { + return "select " + sequenceName + ".nextval from systables"; + } + + public override string GetDropSequenceString(string sequenceName) + { + return "drop sequence " + sequenceName; + } + /// <summary> + /// Generate the select expression fragment that will retrieve the next + /// value of a sequence as part of another (typically DML) statement. + /// </summary> + /// <param name="sequenceName">the name of the sequence </param> + /// <returns> The "nextval" fragment. </returns> + /// <remarks> + /// This differs from <see cref="GetSequenceNextValString"/> in that this + /// should return an expression usable within another statement. + /// </remarks> + public override string GetSelectSequenceNextValString(string sequenceName) + { + return sequenceName + ".nextval"; + } + public override string GetCreateSequenceString(string sequenceName) + { + return "create sequence " + sequenceName; + // + + //" INCREMENT BY 1 START WITH 1 MINVALUE 1 NOCYCLE CACHE 20 NOORDER"; + + } + + // in .NET overloaded version cannot be overriden (in Java allowed) + //protected override string GetCreateSequenceString(string sequenceName, int initialValue, int incrementSize) + //{ + // return "create sequence " + sequenceName + + // " INCREMENT BY " + incrementSize.ToString() + + // " START WITH " + initialValue.ToString() + + // " MINVALUE 1 NOCYCLE CACHE 20 NOORDER"; + //} + + /// <summary> + /// Create a <see cref="JoinFragment"/> strategy responsible + /// for handling this dialect's variations in how joins are handled. + /// </summary> + /// <returns> This dialect's <see cref="JoinFragment"/> strategy. </returns> + public override JoinFragment CreateOuterJoinFragment() + { + // ANSI join exist from 9.21 but CROSS, RIGHT and FULL were introduced in 9.40; + return new ANSIJoinFragment(); + } + + /// <summary> + /// Does this Dialect have some kind of <c>LIMIT</c> syntax? + /// </summary> + /// <value>False, unless overridden.</value> + public override bool SupportsLimit + { + get { return false; } + } + + /// <summary> + /// Does this Dialect support an offset? + /// </summary> + public override bool SupportsLimitOffset + { + get { return false; } + } + + }; +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Dialect/InformixDialect1000.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/InformixDialect1000.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Dialect/InformixDialect1000.cs 2008-12-03 19:45:12 UTC (rev 3942) @@ -0,0 +1,58 @@ +using System.Data; +using NHibernate.Cfg; +using NHibernate.Dialect.Function; +using NHibernate.SqlCommand; +using System.Data.Common; +using NHibernate.Exceptions; +using NHibernate.Util; +//using NHibernate.Dialect.Schema; +using Environment = NHibernate.Cfg.Environment; + + +namespace NHibernate.Dialect +{ + /// <summary> + /// Summary description for InformixDialect. + /// This dialect is intended to work with IDS version 10.00 + /// </summary> + /// <remarks> + /// The InformixDialect defaults the following configuration properties: + /// <list type="table"> + /// <listheader> + /// <term>ConnectionDriver</term> + /// <description>NHibernate.Driver.OdbcDriver</description> + /// <term>PrepareSql</term> + /// <description>true</description> + /// </listheader> + /// <item> + /// <term>connection.driver_class</term> + /// <description><see cref="NHibernate.Driver.OdbcDriver" /></description> + /// </item> + /// </list> + /// </remarks> + public class InformixDialect1000 : InformixDialect0940 + { + /// <summary></summary> + public InformixDialect1000() + : base() + { + } + + /// <summary> + /// Does this Dialect have some kind of <c>LIMIT</c> syntax? + /// </summary> + /// <value>False, unless overridden.</value> + public override bool SupportsLimit + { + get { return true; } + } + + /// <summary> + /// Does this Dialect support an offset? + /// </summary> + public override bool SupportsLimitOffset + { + get { return true; } + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Exceptions/ReflectionBasedSqlStateExtracter.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Exceptions/ReflectionBasedSqlStateExtracter.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Exceptions/ReflectionBasedSqlStateExtracter.cs 2008-12-03 19:45:12 UTC (rev 3942) @@ -0,0 +1,64 @@ +using System.Reflection; +using System.Collections; +using System.Data.Common; + +namespace NHibernate.Exceptions +{ + class ReflectionBasedSqlStateExtracter: SqlStateExtracter + { + + /* OdbcException, OleDbException, IfxException, Db2Exception, and possible others + * have Errors collection which contains fields: NativeError and SQLState + * These fields can be extracted using reflection + */ + public override int ExtractSingleErrorCode(DbException sqle) + { + System.Type type; + PropertyInfo pi; + int nativeError; + + type = sqle.GetType(); + pi = type.GetProperty("Errors"); + if (pi == null) // there is no Errors property + { + return 0; + } + nativeError = 0; + foreach (object o in (pi.GetValue(sqle, null) as IEnumerable)) + { + pi = o.GetType().GetProperty("NativeError"); + if (pi == null) + return 0; + nativeError = (int)pi.GetValue(o, null); + if (nativeError != 0) + break; + } + return nativeError; + } + + public override string ExtractSingleSqlState(DbException sqle) + { + System.Type type; + PropertyInfo pi; + string sqlState; + + type = sqle.GetType(); + pi = type.GetProperty("Errors"); + if (pi == null) // there is no Errors property + { + return null; + } + sqlState = ""; + foreach (object o in (pi.GetValue(sqle, null) as IEnumerable)) + { + pi = o.GetType().GetProperty("SQLState"); + if (pi == null) + return null; + sqlState = (string)pi.GetValue(o, null); + if (sqlState.Length != 0) + break; + } + return sqlState; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Exceptions/SqlStateExtracter.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Exceptions/SqlStateExtracter.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Exceptions/SqlStateExtracter.cs 2008-12-03 19:45:12 UTC (rev 3942) @@ -0,0 +1,51 @@ +using System; +using System.Data.Common; + +namespace NHibernate.Exceptions +{ + public abstract class SqlStateExtracter + { + /* Many drivers provide both SqlState and NativeError in the Exception + * Some of them, like OdbcException, have fields SQLState, NativeError + * Some of them contain it in Data field, like PsqlException + * Some of them have only text message + */ + + public int ExtractErrorCode(DbException sqle) + { + int errorCode; + Exception nested; + errorCode = ExtractSingleErrorCode(sqle); + nested = sqle.InnerException; + while (errorCode == 0 && nested != null) + { + if (nested is DbException) + { + errorCode = ExtractSingleErrorCode(sqle); + } + nested = sqle.InnerException; + } + return errorCode; + } + + public string ExtractSqlState(DbException sqle) + { + string sqlState; + Exception nested; + sqlState = ExtractSingleSqlState(sqle); + nested = sqle.InnerException; + while (sqlState.Length == 0 && nested != null) + { + if (nested is DbException) + { + sqlState = ExtractSingleSqlState(sqle); + } + nested = sqle.InnerException; + } + return sqlState; + } + + public abstract int ExtractSingleErrorCode(DbException sqle); + public abstract string ExtractSingleSqlState(DbException sqle); + } +} Added: trunk/nhibernate/src/NHibernate/Exceptions/TemplatedViolatedConstraintNameExtracter.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Exceptions/TemplatedViolatedConstraintNameExtracter.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Exceptions/TemplatedViolatedConstraintNameExtracter.cs 2008-12-03 19:45:12 UTC (rev 3942) @@ -0,0 +1,44 @@ +using System.Data.Common; + +namespace NHibernate.Exceptions +{ + /// <summary> + /// Knows how to extract a violated constraint name from an error message based on the + /// fact that the constraint name is templated within the message. + /// </summary> + public abstract class TemplatedViolatedConstraintNameExtracter : IViolatedConstraintNameExtracter + { + + /// <summary> + /// Extracts the constraint name based on a template (i.e., <i>templateStart</i><b>constraintName</b><i>templateEnd</i>). + /// </summary> + /// <param name="templateStart">The pattern denoting the start of the constraint name within the message.</param> + /// <param name="templateEnd">The pattern denoting the end of the constraint name within the message.</param> + /// <param name="message">The templated error message containing the constraint name.</param> + /// <returns>The found constraint name, or null.</returns> + protected string ExtractUsingTemplate(string templateStart, string templateEnd, string message) + { + int templateStartPosition = message.IndexOf(templateStart); + if (templateStartPosition < 0) + { + return null; + } + + int start = templateStartPosition + templateStart.Length; + int end = message.IndexOf(templateEnd, start); + if (end < 0) + { + end = message.Length; + } + + return message.Substring(start, end); + } + + /// <summary> + /// Extract the name of the violated constraint from the given SQLException. + /// </summary> + /// <param name="sqle">The exception that was the result of the constraint violation. </param> + /// <returns> The extracted constraint name. </returns> + public abstract string ExtractConstraintName(DbException sqle); + } +} Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2008-11-30 20:32:19 UTC (rev 3941) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2008-12-03 19:45:12 UTC (rev 3942) @@ -443,11 +443,16 @@ <Compile Include="Bytecode\HibernateByteCodeException.cs" /> <Compile Include="Bytecode\ProxyFactoryFactoryNotConfiguredException.cs" /> <Compile Include="Bytecode\UnableToLoadProxyFactoryFactoryException.cs" /> + <Compile Include="Dialect\InformixDialect0940.cs" /> + <Compile Include="Dialect\InformixDialect1000.cs" /> <Compile Include="Dialect\Schema\SQLiteMetaData.cs" /> <Compile Include="Dialect\Schema\SybaseAnywhereMetaData.cs" /> <Compile Include="Dialect\SybaseASA10Dialect.cs" /> <Compile Include="Dialect\SybaseASA9Dialect.cs" /> <Compile Include="Driver\IfxDriver.cs" /> + <Compile Include="Exceptions\ReflectionBasedSqlStateExtracter.cs" /> + <Compile Include="Exceptions\SqlStateExtracter.cs" /> + <Compile Include="Exceptions\TemplatedViolatedConstraintNameExtracter.cs" /> <Compile Include="Id\SelectGenerator.cs" /> <Compile Include="Properties\BackFieldStrategy.cs" /> <Compile Include="Bytecode\CodeDom\BytecodeProviderImpl.cs" /> @@ -836,6 +841,7 @@ <Compile Include="Proxy\Poco\BasicLazyInitializer.cs" /> <Compile Include="QueryParameterException.cs" /> <Compile Include="SessionException.cs" /> + <Compile Include="SqlCommand\InformixJoinFragment.cs" /> <Compile Include="SqlCommand\SubselectClauseExtractor.cs" /> <Compile Include="Engine\SubselectFetch.cs" /> <Compile Include="Criterion\DetachedCriteria.cs" /> Added: trunk/nhibernate/src/NHibernate/SqlCommand/InformixJoinFragment.cs =================================================================== --- trunk/nhibernate/src/NHibernate/SqlCommand/InformixJoinFragment.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/SqlCommand/InformixJoinFragment.cs 2008-12-03 19:45:12 UTC (rev 3942) @@ -0,0 +1,113 @@ +using System; +using System.Text; +using Iesi.Collections; +using NHibernate.Util; + +namespace NHibernate.SqlCommand +{ + /// <summary> + /// An Informix-style (theta) Join + /// </summary> + public class InformixJoinFragment : JoinFragment + { + private SqlStringBuilder afterFrom = new SqlStringBuilder(); + private SqlStringBuilder afterWhere = new SqlStringBuilder(); + + public override void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType) + { + string joinString; + switch (joinType) + { + case JoinType.InnerJoin: + AddCrossJoin(tableName, alias); + break; + case JoinType.LeftOuterJoin: + afterFrom.Add(StringHelper.CommaSpace) + .Add("outer ") + .Add(tableName) + .Add(" ") + .Add(alias); + break; + case JoinType.RightOuterJoin: + int i = GetPrevTableInsertPoint(afterFrom.ToSqlString()); + afterFrom.Insert(i, "outer "); + break; + case JoinType.FullJoin: + throw new NotSupportedException("join type not supported by Informix"); + default: + throw new AssertionFailure("undefined join type"); + } + + for (int j = 0; j < fkColumns.Length; j++) + { + //HasThetaJoins = true; + afterWhere.Add(" and " + fkColumns[j]); + afterWhere.Add("=" + alias + StringHelper.Dot + pkColumns[j]); + } + } + + public override void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType, + string on) + { + //arbitrary on clause ignored!! + AddJoin(tableName, alias, fkColumns, pkColumns, joinType); + AddCondition(on); + } + + public override SqlString ToFromFragmentString + { + get { return afterFrom.ToSqlString(); } + } + + public override SqlString ToWhereFragmentString + { + get { return afterWhere.ToSqlString(); } + } + + public override void AddJoins(SqlString fromFragment, SqlString whereFragment) + { + afterFrom.Add(fromFragment); + afterWhere.Add(whereFragment); + } + + public override void AddCrossJoin(string tableName, string alias) + { + afterFrom.Add(StringHelper.CommaSpace) + .Add(tableName) + .Add(" ") + .Add(alias); + } + + public override bool AddCondition(string condition) + { + return AddCondition(afterWhere, condition); + } + + public override bool AddCondition(SqlString condition) + { + return AddCondition(afterWhere, condition); + } + + public override void AddFromFragmentString(SqlString fromFragmentString) + { + afterFrom.Add(fromFragmentString); + } + + private static int GetPrevTableInsertPoint(SqlString text) + { + int i, j; + + i = text.LastIndexOfCaseInsensitive("from"); + j = text.LastIndexOfCaseInsensitive(","); + if (i == -1 && j == -1) + { + return -1; + } + if (j > i) + { + return j + 1; + } + return i + 5; + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dav...@us...> - 2008-11-30 20:32:24
|
Revision: 3941 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3941&view=rev Author: davybrion Date: 2008-11-30 20:32:19 +0000 (Sun, 30 Nov 2008) Log Message: ----------- reverting patch for NH-1579 Modified Paths: -------------- branches/2.0.x/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs branches/2.0.x/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj Removed Paths: ------------- branches/2.0.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1579/ Modified: branches/2.0.x/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs =================================================================== --- branches/2.0.x/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs 2008-11-30 20:10:54 UTC (rev 3940) +++ branches/2.0.x/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs 2008-11-30 20:32:19 UTC (rev 3941) @@ -522,8 +522,7 @@ public override string OneToManyFilterFragment(string alias) { - //Previous code was checking forceDiscriminator value here, which caused issues with collection loading. - return DiscriminatorFilterFragment(alias); + return forceDiscriminator ? DiscriminatorFilterFragment(alias) : string.Empty; } private string DiscriminatorFilterFragment(string alias) Modified: branches/2.0.x/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj =================================================================== --- branches/2.0.x/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj 2008-11-30 20:10:54 UTC (rev 3940) +++ branches/2.0.x/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj 2008-11-30 20:32:19 UTC (rev 3941) @@ -1,19 +1,14 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> + <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{7AEE5B37-C552-4E59-9B6F-88755BCB5070}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>NHibernate.Test</RootNamespace> <AssemblyName>NHibernate.Test</AssemblyName> - <FileUpgradeFlags> - </FileUpgradeFlags> - <OldToolsVersion>2.0</OldToolsVersion> - <UpgradeBackupLocation> - </UpgradeBackupLocation> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -270,12 +265,6 @@ <Compile Include="NHSpecificTest\BasicTimeFixture.cs" /> <Compile Include="NHSpecificTest\BugTestCase.cs" /> <Compile Include="NHSpecificTest\CollectionFixture.cs" /> - <Compile Include="NHSpecificTest\NH1579\Apple.cs" /> - <Compile Include="NHSpecificTest\NH1579\Cart.cs" /> - <Compile Include="NHSpecificTest\NH1579\Entity.cs" /> - <Compile Include="NHSpecificTest\NH1579\Fruit.cs" /> - <Compile Include="NHSpecificTest\NH1579\NH1579Fixture.cs" /> - <Compile Include="NHSpecificTest\NH1579\Orange.cs" /> <Compile Include="NHSpecificTest\NH1077\A.cs" /> <Compile Include="NHSpecificTest\NH1077\Fixture.cs" /> <Compile Include="NHSpecificTest\NH1098\FilterParameterOrderFixture.cs" /> @@ -1374,9 +1363,6 @@ <EmbeddedResource Include="NHSpecificTest\NH1508\Mappings.hbm.xml" /> </ItemGroup> <ItemGroup> - <EmbeddedResource Include="NHSpecificTest\NH1579\Mappings.hbm.xml" /> - </ItemGroup> - <ItemGroup> <Folder Include="Properties\" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> @@ -1395,4 +1381,4 @@ if exist "$(ProjectDir)hibernate.cfg.xml" (copy "$(ProjectDir)hibernate.cfg.xml" "hibernate.cfg.xml") copy /y "..\..\..\NHibernate.DomainModel\ABC.hbm.xml" "ABC.hbm.xml"</PostBuildEvent> </PropertyGroup> -</Project> +</Project> \ 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...> - 2008-11-30 20:10:58
|
Revision: 3940 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3940&view=rev Author: fabiomaulo Date: 2008-11-30 20:10:54 +0000 (Sun, 30 Nov 2008) Log Message: ----------- Revert of r3937 because NH-1579 is not an issue (wrong mapping) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1579/Mappings.hbm.xml Modified: trunk/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs 2008-11-30 00:54:18 UTC (rev 3939) +++ trunk/nhibernate/src/NHibernate/Persister/Entity/SingleTableEntityPersister.cs 2008-11-30 20:10:54 UTC (rev 3940) @@ -522,8 +522,7 @@ public override string OneToManyFilterFragment(string alias) { - //Previous code was checking forceDiscriminator value here, which caused issues with collection loading. - return DiscriminatorFilterFragment(alias); + return forceDiscriminator ? DiscriminatorFilterFragment(alias) : string.Empty; } private string DiscriminatorFilterFragment(string alias) Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1579/Mappings.hbm.xml =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1579/Mappings.hbm.xml 2008-11-30 00:54:18 UTC (rev 3939) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1579/Mappings.hbm.xml 2008-11-30 20:10:54 UTC (rev 3940) @@ -4,7 +4,7 @@ <id name="ID"> <generator class="guid.comb" /> </id> - <discriminator column="EntityType" length="64"/> + <discriminator column="EntityType" length="64" force="true"/> </class> <subclass name="Fruit" abstract="true" discriminator-value="Fruit" extends="NHibernate.Test.NHSpecificTest.NH1579.Entity, NHibernate.Test"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dav...@us...> - 2008-11-30 00:54:27
|
Revision: 3939 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3939&view=rev Author: davybrion Date: 2008-11-30 00:54:18 +0000 (Sun, 30 Nov 2008) Log Message: ----------- Removed the EntityLoadContext class since it wasn't really used anywhere Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Engine/Loading/LoadContexts.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj Removed Paths: ------------- trunk/nhibernate/src/NHibernate/Engine/Loading/EntityLoadContext.cs Deleted: trunk/nhibernate/src/NHibernate/Engine/Loading/EntityLoadContext.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Engine/Loading/EntityLoadContext.cs 2008-11-29 18:25:20 UTC (rev 3938) +++ trunk/nhibernate/src/NHibernate/Engine/Loading/EntityLoadContext.cs 2008-11-30 00:54:18 UTC (rev 3939) @@ -1,34 +0,0 @@ -using System.Collections; -using System.Data; -using log4net; - -namespace NHibernate.Engine.Loading -{ - public class EntityLoadContext - { - private static readonly ILog log = LogManager.GetLogger(typeof(EntityLoadContext)); - private LoadContexts loadContexts; - private readonly IDataReader resultSet; - private readonly IList hydratingEntities = new ArrayList(20); // todo : need map? the prob is a proper key, right? - - public EntityLoadContext(LoadContexts loadContexts, IDataReader resultSet) - { - this.loadContexts = loadContexts; - this.resultSet = resultSet; - } - - internal void Cleanup() - { - if (!(hydratingEntities.Count == 0)) - { - log.Warn("On CollectionLoadContext#clear, hydratingEntities contained [" + hydratingEntities.Count + "] entries"); - } - hydratingEntities.Clear(); - } - - public override string ToString() - { - return base.ToString() + "<rs=" + resultSet + ">"; - } - } -} Modified: trunk/nhibernate/src/NHibernate/Engine/Loading/LoadContexts.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Engine/Loading/LoadContexts.cs 2008-11-29 18:25:20 UTC (rev 3938) +++ trunk/nhibernate/src/NHibernate/Engine/Loading/LoadContexts.cs 2008-11-30 00:54:18 UTC (rev 3939) @@ -31,7 +31,6 @@ [NonSerialized] private readonly IPersistenceContext persistenceContext; private IDictionary collectionLoadContexts; - private IDictionary entityLoadContexts; private Dictionary<CollectionKey, LoadingCollectionEntry> xrefLoadingCollectionEntries; @@ -72,20 +71,10 @@ { if (collectionLoadContexts != null) { - object tempObject; - tempObject = collectionLoadContexts[resultSet]; - collectionLoadContexts.Remove(resultSet); - CollectionLoadContext collectionLoadContext = (CollectionLoadContext)tempObject; + CollectionLoadContext collectionLoadContext = (CollectionLoadContext)collectionLoadContexts[resultSet]; collectionLoadContext.Cleanup(); + collectionLoadContexts.Remove(resultSet); } - if (entityLoadContexts != null) - { - object tempObject2; - tempObject2 = entityLoadContexts[resultSet]; - entityLoadContexts.Remove(resultSet); - EntityLoadContext entityLoadContext = (EntityLoadContext)tempObject2; - entityLoadContext.Cleanup(); - } } /// <summary> Release internal state associated with *all* result sets. </summary> @@ -104,15 +93,6 @@ } collectionLoadContexts.Clear(); } - if (entityLoadContexts != null) - { - foreach (EntityLoadContext entityLoadContext in entityLoadContexts.Values) - { - log.Warn("fail-safe cleanup (entities) : " + entityLoadContext); - entityLoadContext.Cleanup(); - } - entityLoadContexts.Clear(); - } } /// <summary> @@ -262,24 +242,5 @@ foreach (CollectionKey entryKey in entryKeys) xrefLoadingCollectionEntries.Remove(entryKey); } - - public EntityLoadContext GetEntityLoadContext(IDataReader resultSet) - { - EntityLoadContext context = null; - if (entityLoadContexts == null) - { - entityLoadContexts = IdentityMap.Instantiate(8); - } - else - { - context = (EntityLoadContext)entityLoadContexts[resultSet]; - } - if (context == null) - { - context = new EntityLoadContext(this, resultSet); - entityLoadContexts[resultSet] = context; - } - return context; - } } } Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2008-11-29 18:25:20 UTC (rev 3938) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2008-11-30 00:54:18 UTC (rev 3939) @@ -616,7 +616,6 @@ <Compile Include="Engine\IdentifierValue.cs" /> <Compile Include="Engine\IPersistenceContext.cs" /> <Compile Include="Engine\Loading\CollectionLoadContext.cs" /> - <Compile Include="Engine\Loading\EntityLoadContext.cs" /> <Compile Include="Engine\Loading\LoadContexts.cs" /> <Compile Include="Engine\Loading\LoadingCollectionEntry.cs" /> <Compile Include="Engine\Nullability.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |