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: Michael D. <mik...@us...> - 2004-04-19 04:32:39
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16820/NHibernate/Sql Modified Files: QueryJoinFragment.cs Log Message: Trying to get the HQL back to being able to handle the basic HQL - found some quick fixes. Index: QueryJoinFragment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/QueryJoinFragment.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QueryJoinFragment.cs 9 Mar 2003 15:10:10 -0000 1.2 --- QueryJoinFragment.cs 19 Apr 2004 04:32:30 -0000 1.3 *************** *** 83,88 **** public override void AddCondition(string condition) { ! if ( !condition.StartsWith(" and ") ) afterWhere.Append(" and "); ! afterWhere.Append(condition); } --- 83,95 ---- public override void AddCondition(string condition) { ! if ( ! afterFrom.ToString().IndexOf( condition.Trim() ) < 0 && ! afterWhere.ToString().IndexOf( condition.Trim() ) < 0 ) ! { ! ! ! if ( !condition.StartsWith(" and ") ) afterWhere.Append(" and "); ! afterWhere.Append(condition); ! } } |
From: Michael D. <mik...@us...> - 2004-04-19 04:32:38
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16820/NHibernate/Hql Modified Files: FromParser.cs QueryTranslator.cs Log Message: Trying to get the HQL back to being able to handle the basic HQL - found some quick fixes. Index: QueryTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/QueryTranslator.cs,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** QueryTranslator.cs 15 Apr 2004 11:36:35 -0000 1.24 --- QueryTranslator.cs 19 Apr 2004 04:32:30 -0000 1.25 *************** *** 286,297 **** } internal string CreateNameFor(System.Type type) { ! return Prefix(type.Name) + NextCount() + StringHelper.Underscore; } internal string CreateNameForCollection(string role) { ! return Prefix( StringHelper.Unqualify(role) ) + NextCount() + StringHelper.Underscore; } --- 286,308 ---- } + internal string CreateName(string description) + { + // this is a bit ugly, since Alias is really for + // aliasing SQL identifiers ... but it does what + // we want! + return new Alias(10, NextCount().ToString() + StringHelper.Underscore) + .ToAliasString(StringHelper.Unqualify(description).ToLower(), dialect); + } + internal string CreateNameFor(System.Type type) { ! return CreateName(type.Name); ! //return Prefix(type.Name) + NextCount() + StringHelper.Underscore; } internal string CreateNameForCollection(string role) { ! return CreateName(role); ! //return Prefix( StringHelper.Unqualify(role) ) + NextCount() + StringHelper.Underscore; } Index: FromParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/FromParser.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FromParser.cs 14 Apr 2004 12:34:00 -0000 1.5 --- FromParser.cs 19 Apr 2004 04:32:30 -0000 1.6 *************** *** 24,27 **** --- 24,28 ---- private bool afterJoinType; private bool afterFetch; + //TODO: H2.0.3 does not have classPersister as a field... private ILoadable classPersister; private JoinType joinType = JoinType.None; *************** *** 42,46 **** if ( lcToken.Equals(StringHelper.Comma) ) { ! if (!expectingJoin) throw new QueryException("unexpected token: ,"); expectingJoin = false; expectingAs = false; --- 43,47 ---- if ( lcToken.Equals(StringHelper.Comma) ) { ! if ( !(expectingJoin|expectingAs) ) throw new QueryException("unexpected token: ,"); expectingJoin = false; expectingAs = false; *************** *** 79,83 **** else if ( joinTypes.Contains(lcToken) ) { ! if (!expectingJoin) throw new QueryException("unexpected token: " + token); joinType = (JoinType) joinTypes[lcToken]; afterJoinType = true; --- 80,84 ---- else if ( joinTypes.Contains(lcToken) ) { ! if ( !(expectingJoin|expectingAs) ) throw new QueryException("unexpected token: " + token); joinType = (JoinType) joinTypes[lcToken]; afterJoinType = true; *************** *** 119,127 **** // AS construction ! if (classPersister!=null) ! { ! q.AddFromClass(token, classPersister); ! } ! else if (entityName!=null) { q.SetAliasName(token, entityName); --- 120,129 ---- // AS construction ! // if (classPersister!=null) ! // { ! // q.AddFromClass(token, classPersister); ! // } ! //else if (entityName!=null) ! if (entityName!=null) { q.SetAliasName(token, entityName); |
From: Michael D. <mik...@us...> - 2004-04-19 04:31:13
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16670/NHibernate/Sql Modified Files: QuerySelect.cs Log Message: no message Index: QuerySelect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/QuerySelect.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** QuerySelect.cs 17 Mar 2003 21:13:53 -0000 1.3 --- QuerySelect.cs 19 Apr 2004 04:31:04 -0000 1.4 *************** *** 100,106 **** .Append("select "); if (distinct) buf.Append("distinct "); ! buf.Append(select) .Append(" from") ! .Append( joins.ToFromFragmentString.Substring(1) ); string part1 = joins.ToWhereFragmentString.Trim(); string part2 = where.ToString().Trim(); --- 100,117 ---- .Append("select "); if (distinct) buf.Append("distinct "); ! ! string from = joins.ToFromFragmentString; ! if ( from.StartsWith(",") ) ! { ! from = from.Substring(1); ! } ! else if ( from.StartsWith(" inner join") ) ! { ! from = from.Substring(11); ! } ! ! buf.Append(select.ToString()) .Append(" from") ! .Append( from ); string part1 = joins.ToWhereFragmentString.Trim(); string part2 = where.ToString().Trim(); |
From: Michael D. <mik...@us...> - 2004-04-16 14:12:18
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9135/Dialect Modified Files: Dialect.cs MsSql2000Dialect.cs Log Message: Updated comments in Dialect to better explain the Quoting and removed commented out methods from MsSql2000Dialect because the base class' implementation of those methods is just fine. Index: Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/Dialect.cs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Dialect.cs 15 Apr 2004 21:07:18 -0000 1.27 --- Dialect.cs 16 Apr 2004 14:12:09 -0000 1.28 *************** *** 425,429 **** /// The opening quote for a quoted identifier. /// </summary> - //[Obsolete("Should use Quote functions")] protected virtual char OpenQuote { --- 425,428 ---- *************** *** 434,438 **** /// The closing quote for a quoted identifier. /// </summary> - //[Obsolete("Should use Quote functions")] protected virtual char CloseQuote { --- 433,436 ---- *************** *** 731,761 **** /// <remarks> /// The default implementation is to compare the first character ! /// to Dialect.OpenQuote. /// </remarks> public virtual bool IsQuoted(string name) { ! //TODO: should we use regex here - performance implications ! // or just live with the bug that if the first char in the name ! // ! return name[0]==OpenQuote; } /// <summary> ! /// Unquotes an already quoted name /// </summary> /// <param name="quoted">Quoted string</param> /// <returns>Unquoted string</returns> /// <remarks> ! /// The Default implementation checks the first char to see if it is ! /// == to OpenQuote and if so then it returns the string without the ! /// first and last char. If this implementation is not sufficient for ! /// your Dialect then it needs to be overridden. /// </remarks> public virtual string UnQuote(string quoted) { if (IsQuoted(quoted)) ! return quoted.Substring(1, quoted.Length - 2); ! return quoted; } --- 729,781 ---- /// <remarks> /// The default implementation is to compare the first character ! /// to Dialect.OpenQuote and the last char to Dialect.CloseQuote /// </remarks> public virtual bool IsQuoted(string name) { ! return (name[0]==OpenQuote && name[name.Length-1]==CloseQuote); } /// <summary> ! /// Unquotes and unescapes an already quoted name /// </summary> /// <param name="quoted">Quoted string</param> /// <returns>Unquoted string</returns> /// <remarks> ! /// <p> ! /// This method checks the string <c>quoted</c> to see if it is ! /// quoted. If the string <c>quoted</c> is already enclosed in the OpenQuote ! /// and CloseQuote then those chars are removed. ! /// </p> ! /// <p> ! /// After the OpenQuote and CloseQuote have been cleaned from the string <c>quoted</c> ! /// then any chars in the string <c>quoted</c> that have been escaped by doubling them ! /// up are changed back to a single version. ! /// </p> ! /// <p> ! /// The following quoted values return these results ! /// "quoted" = quoted ! /// "quote""d" = quote"d ! /// quote""d = quote"d ! /// </p> ! /// <p> ! /// If this implementation is not sufficient for your Dialect then it needs to be overridden. ! /// MsSql2000Dialect is an example of where UnQuoting rules are different. ! /// </p> /// </remarks> public virtual string UnQuote(string quoted) { + string unquoted; + if (IsQuoted(quoted)) ! unquoted = quoted.Substring(1, quoted.Length - 2); ! else ! unquoted = quoted; ! unquoted = unquoted.Replace( new string(OpenQuote, 2), OpenQuote.ToString() ); ! ! if( OpenQuote!= CloseQuote) ! unquoted = unquoted.Replace( new string(CloseQuote, 2), CloseQuote.ToString() ); ! ! return unquoted; } *************** *** 781,818 **** - - /// <summary> - /// Quotes a name for being used as a tablename - /// </summary> - /// <param name="tableName">Name of the table</param> - /// <returns>A Quoted name in the format of OpenQuote + tableName + CloseQuote</returns> - /// <remarks></remarks> - public virtual string QuoteForTableName(string tableName) - { - return IsQuoted(tableName) ? - tableName : - Quote(tableName); - - } - - /// <summary> - /// Quotes a name for being used as a columnname - /// </summary> - /// <remarks>Original implementation calls <see cref="QuoteForTableName"/></remarks> - /// <param name="columnName">Name of the column</param> - /// <returns>A Quoted name in the format of OpenQuote + columnName + CloseQuote</returns> - public virtual string QuoteForColumnName(string columnName) - { - return IsQuoted(columnName) ? - columnName : - Quote(columnName); - - } - /// <summary> /// Quotes a name. /// </summary> ! /// <param name="name">The string to Quote</param> /// <returns>A QuotedName </returns> protected virtual string Quote(string name) { --- 801,816 ---- /// <summary> /// Quotes a name. /// </summary> ! /// <param name="name">The string that needs to be Quoted.</param> /// <returns>A QuotedName </returns> + /// <remarks> + /// <p> + /// This method assumes that the name is not already Quoted. So if the name passed + /// in is <c>"name</c> then it will return <c>"""name"</c>. It escapes the first char + /// - the " with "" and encloses the escaped string with OpenQuote and CloseQuote. + /// </p> + /// </remarks> protected virtual string Quote(string name) { *************** *** 836,839 **** --- 834,845 ---- /// <param name="columnName">Name of the alias</param> /// <returns>A Quoted name in the format of OpenQuote + aliasName + CloseQuote</returns> + /// <remarks> + /// <p> + /// If the aliasName is already enclosed in the OpenQuote and CloseQuote then this + /// method will return the aliasName that was passed in without going through any + /// Quoting process. So if aliasName is passed in already Quoted make sure that + /// you have escaped all of the chars according to your DataBase's specifications. + /// </p> + /// </remarks> public virtual string QuoteForAliasName(string aliasName) { *************** *** 844,848 **** --- 850,897 ---- } + /// <summary> + /// Quotes a name for being used as a columnname + /// </summary> + /// <remarks>Original implementation calls <see cref="QuoteForTableName"/></remarks> + /// <param name="columnName">Name of the column</param> + /// <returns>A Quoted name in the format of OpenQuote + columnName + CloseQuote</returns> + /// <remarks> + /// <p> + /// If the columnName is already enclosed in the OpenQuote and CloseQuote then this + /// method will return the columnName that was passed in without going through any + /// Quoting process. So if columnName is passed in already Quoted make sure that + /// you have escaped all of the chars according to your DataBase's specifications. + /// </p> + /// </remarks> + public virtual string QuoteForColumnName(string columnName) + { + return IsQuoted(columnName) ? + columnName : + Quote(columnName); + + } + + /// <summary> + /// Quotes a name for being used as a tablename + /// </summary> + /// <param name="tableName">Name of the table</param> + /// <returns>A Quoted name in the format of OpenQuote + tableName + CloseQuote</returns> + /// <remarks> + /// <p> + /// If the tableName is already enclosed in the OpenQuote and CloseQuote then this + /// method will return the tableName that was passed in without going through any + /// Quoting process. So if tableName is passed in already Quoted make sure that + /// you have escaped all of the chars according to your DataBase's specifications. + /// </p> + /// </remarks> + public virtual string QuoteForTableName(string tableName) + { + return IsQuoted(tableName) ? + tableName : + Quote(tableName); + + } + public class CountQueryFunctionInfo : IQueryFunctionInfo { Index: MsSql2000Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MsSql2000Dialect.cs 15 Apr 2004 21:07:18 -0000 1.10 --- MsSql2000Dialect.cs 16 Apr 2004 14:12:10 -0000 1.11 *************** *** 92,122 **** } - // /// <summary> - // /// MsSql ov - // /// </summary> - // /// <param name="tableName"></param> - // /// <returns></returns> - // /// <remarks> - // /// MsSql needs to override it because it allows the ] to be a valid char - // /// in a table name. - // /// </remarks> - // public override string QuoteForTableName(string tableName) - // { - // if ( IsQuoted(tableName) ) return tableName; - // return Quote(tableName); // return OpenQuote + tableName.Replace(CloseQuote.ToString(), new string(CloseQuote, 2) ) + CloseQuote; - // } - // - // public override string QuoteForAliasName(string aliasName) - // { - // if ( IsQuoted(aliasName) ) return aliasName; - // return Quote(tableName); // return OpenQuote + aliasName.Replace(CloseQuote.ToString(), new string(CloseQuote, 2) ) + CloseQuote; - // } - // - // public override string QuoteForColumnName(string columnName) - // { - // if ( IsQuoted(columnName) ) return columnName; - // return Quote(tableName); // return OpenQuote + columnName.Replace(CloseQuote.ToString(), new string(CloseQuote, 2) ) + CloseQuote; - // } - public override string UnQuote(string quoted) { --- 92,95 ---- |
From: Michael D. <mik...@us...> - 2004-04-16 14:08:44
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8053 Modified Files: NHibernate.Test-1.1.csproj Log Message: Added TestFixture's for Dialect and MsSqlDialect to test for Quoting. I need to get in the habit of writing these things first ;) Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** NHibernate.Test-1.1.csproj 14 Apr 2004 18:08:28 -0000 1.14 --- NHibernate.Test-1.1.csproj 16 Apr 2004 14:08:35 -0000 1.15 *************** *** 218,221 **** --- 218,231 ---- /> <File + RelPath = "DialectTest\DialectFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "DialectTest\MsSqlDialectFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "ExpressionTest\BaseExpressionFixture.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-04-16 14:08:43
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/DialectTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8053/DialectTest Added Files: DialectFixture.cs MsSqlDialectFixture.cs Log Message: Added TestFixture's for Dialect and MsSqlDialect to test for Quoting. I need to get in the habit of writing these things first ;) --- NEW FILE: DialectFixture.cs --- using System; using NHibernate.Dialect; using NUnit.Framework; namespace NHibernate.Test.DialectTest { /// <summary> /// Summary description for DialectFixture. /// </summary> [TestFixture] public class DialectFixture { protected Dialect.Dialect d = null; const int BeforeQuoteIndex = 0; const int AfterQuoteIndex = 1; const int AfterUnquoteIndex = 2; protected string[] tableWithNothingToBeQuoted; // simulating a string already enclosed in the Dialects quotes of Quote"d[Na$` // being passed in that should be returned as Quote""d[Na$` - notice the "" before d protected string[] tableAlreadyQuoted; // simulating a string that has NOT been enclosed in the Dialects quotes and needs to // be. protected string[] tableThatNeedsToBeQuoted; [SetUp] public virtual void SetUp() { // Generic Dialect inherits all of the Quoting functions from // Dialect (which is abstract) d = new Dialect.GenericDialect(); tableWithNothingToBeQuoted = new string[] {"plainname", "\"plainname\""}; tableAlreadyQuoted = new string[] {"\"Quote\"\"d[Na$`\"", "\"Quote\"\"d[Na$`\"","Quote\"d[Na$`" }; tableThatNeedsToBeQuoted = new string[] {"Quote\"d[Na$`", "\"Quote\"\"d[Na$`\"", "Quote\"d[Na$`"}; } [Test] public void IsQuotedTrue() { Assert.IsTrue( d.IsQuoted(tableAlreadyQuoted[BeforeQuoteIndex]) ); } /// <summary> /// Test that only the first char identifies that the Identifier /// is Quoted - regardless of what chars are contained in it. /// </summary> [Test] public void IsQuotedFalse() { Assert.IsFalse( d.IsQuoted(tableThatNeedsToBeQuoted[BeforeQuoteIndex]) ); } [Test] public void QuoteTableNameNeeded() { Assert.AreEqual( tableThatNeedsToBeQuoted[AfterQuoteIndex], d.QuoteForTableName(tableThatNeedsToBeQuoted[BeforeQuoteIndex]) ); } [Test] public void QuoteTableNameNotNeeded() { Assert.AreEqual( tableWithNothingToBeQuoted[AfterQuoteIndex], d.QuoteForTableName( tableWithNothingToBeQuoted[BeforeQuoteIndex] ) ); } [Test] public void QuoteTableNameAlreadyQuoted() { Assert.AreEqual( tableAlreadyQuoted[BeforeQuoteIndex] , d.QuoteForTableName( tableAlreadyQuoted[BeforeQuoteIndex] ) ); } /// <summary> /// Test that it does not matter if the name passed in has been quoted or not /// already. The UnQuote should take care of it and return the same result. /// </summary> [Test] public void UnQuoteAlreadyQuoted() { Assert.AreEqual( tableAlreadyQuoted[AfterUnquoteIndex] , d.UnQuote( tableAlreadyQuoted[BeforeQuoteIndex] ) ); Assert.AreEqual( tableAlreadyQuoted[AfterUnquoteIndex] , d.UnQuote( tableAlreadyQuoted[AfterQuoteIndex] ) ); } [Test] public void UnQuoteNeedingQuote() { Assert.AreEqual( tableThatNeedsToBeQuoted[AfterUnquoteIndex] , d.UnQuote( tableThatNeedsToBeQuoted[BeforeQuoteIndex] ) ); Assert.AreEqual( tableThatNeedsToBeQuoted[AfterUnquoteIndex] , d.UnQuote( tableThatNeedsToBeQuoted[AfterQuoteIndex] ) ); } [Test] public void UnQuoteArray() { string[] actualUnquoted = new string[2]; string[] expectedUnquoted = new string[] {tableThatNeedsToBeQuoted[AfterUnquoteIndex], tableAlreadyQuoted[AfterUnquoteIndex] }; actualUnquoted = d.UnQuote(new string[] {tableThatNeedsToBeQuoted[BeforeQuoteIndex], tableAlreadyQuoted[BeforeQuoteIndex] } ); ObjectAssertion.AssertEquals(expectedUnquoted, actualUnquoted, true); } } } --- NEW FILE: MsSqlDialectFixture.cs --- using System; using NUnit.Framework; namespace NHibernate.Test.DialectTest { /// <summary> /// Summary description for MsSqlDialectFixture. /// </summary> [TestFixture] public class MsSqlDialectFixture : DialectFixture { [SetUp] public override void SetUp() { // Generic Dialect inherits all of the Quoting functions from // Dialect (which is abstract) d = new Dialect.MsSql2000Dialect(); tableWithNothingToBeQuoted = new string[] {"plainname", "[plainname]"}; tableAlreadyQuoted = new string[] {"[Quote[d[Na]]$`]", "[Quote[d[Na]]$`]","Quote[d[Na]$`" }; tableThatNeedsToBeQuoted = new string[] {"Quote[d[Na]$`", "[Quote[d[Na]]$`]", "Quote[d[Na]$`"}; } } } |
From: Michael D. <mik...@us...> - 2004-04-16 14:07:28
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7808 Modified Files: TestCase.cs Log Message: Added a protected field dialect. Index: TestCase.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/TestCase.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TestCase.cs 15 Apr 2004 13:21:19 -0000 1.10 --- TestCase.cs 16 Apr 2004 14:07:19 -0000 1.11 *************** *** 15,18 **** --- 15,19 ---- { protected Configuration cfg; + protected Dialect.Dialect dialect; protected ISessionFactory sessions; *************** *** 32,37 **** if(exportSchema) new SchemaExport(cfg).Create(true, true); ! sessions = cfg.BuildSessionFactory( ); } --- 33,39 ---- if(exportSchema) new SchemaExport(cfg).Create(true, true); ! sessions = cfg.BuildSessionFactory( ); + dialect = Dialect.Dialect.GetDialect(); } |
From: Michael D. <mik...@us...> - 2004-04-16 14:06:45
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7673 Modified Files: BasicTypes.cs ObjectAssertion.cs Log Message: Added an ObjectAssertion for an IList that takes a parameter indicating if the order of items in the List matters. The <bag> mapping is not being stored in any particular order in MySql while MsSql stores them in the order they are inserted. Index: ObjectAssertion.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ObjectAssertion.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ObjectAssertion.cs 15 Feb 2004 22:52:41 -0000 1.2 --- ObjectAssertion.cs 16 Apr 2004 14:06:35 -0000 1.3 *************** *** 40,48 **** { ! Assertion.AssertEquals(expected.Count, actual.Count); for(int i = 0; i < expected.Count; i++) { ! Assertion.AssertEquals("The item at index " + i + " was not equal", expected[i], actual[i]); } } --- 40,65 ---- { ! AssertEquals(expected, actual, true); ! } + /// <summary> + /// + /// </summary> + /// <param name="expected"></param> + /// <param name="actual"></param> + /// <param name="indexMatters">A boolean indicating if the List are compared at Index or by Contains.</param> + internal static void AssertEquals(IList expected, IList actual, bool indexMatters) + { + Assert.AreEqual(expected.Count, actual.Count); for(int i = 0; i < expected.Count; i++) { ! if(indexMatters) ! { ! Assert.IsTrue(expected[i].Equals(actual[i]), "The item at index " + i + " was not equal" ); ! } ! else ! { ! Assert.IsTrue(actual.Contains(expected[i]), "The item " + expected[i].ToString() + " could not be found in the actual List."); ! } } } Index: BasicTypes.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/BasicTypes.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BasicTypes.cs 14 Apr 2004 18:09:41 -0000 1.6 --- BasicTypes.cs 16 Apr 2004 14:06:35 -0000 1.7 *************** *** 885,889 **** ObjectAssertion.AssertEquals(expected.StringArray, actual.StringArray); ObjectAssertion.AssertEquals(expected.Int32Array, actual.Int32Array); ! ObjectAssertion.AssertEquals(expected.StringBag, actual.StringBag); ObjectAssertion.AssertEquals(expected.StringList, actual.StringList); ObjectAssertion.AssertEquals(expected.StringMap, actual.StringMap, true); --- 885,889 ---- ObjectAssertion.AssertEquals(expected.StringArray, actual.StringArray); ObjectAssertion.AssertEquals(expected.Int32Array, actual.Int32Array); ! ObjectAssertion.AssertEquals(expected.StringBag, actual.StringBag, false); ObjectAssertion.AssertEquals(expected.StringList, actual.StringList); ObjectAssertion.AssertEquals(expected.StringMap, actual.StringMap, true); |
From: Michael D. <mik...@us...> - 2004-04-16 14:05:06
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ExpressionTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7332/ExpressionTest Modified Files: BaseExpressionFixture.cs Log Message: Added a protected field dialect to help with Quoting. Probably don't need it because the Test don't use chars that need to be Quoted. Index: BaseExpressionFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ExpressionTest/BaseExpressionFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BaseExpressionFixture.cs 20 Mar 2004 23:08:55 -0000 1.1 --- BaseExpressionFixture.cs 16 Apr 2004 14:04:58 -0000 1.2 *************** *** 17,21 **** protected ISessionFactory factory; protected ISessionFactoryImplementor factoryImpl; ! [SetUp] public void SetUp() --- 17,22 ---- protected ISessionFactory factory; protected ISessionFactoryImplementor factoryImpl; ! protected Dialect.Dialect dialect; ! [SetUp] public void SetUp() *************** *** 26,30 **** factory = cfg.BuildSessionFactory(); factoryImpl = (ISessionFactoryImplementor)factory; ! } --- 27,31 ---- factory = cfg.BuildSessionFactory(); factoryImpl = (ISessionFactoryImplementor)factory; ! dialect = Dialect.Dialect.GetDialect(); } |
From: Michael D. <mik...@us...> - 2004-04-16 14:00:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/DialectTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6481/DialectTest Log Message: Directory /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/DialectTest added to the repository |
From: Michael D. <mik...@us...> - 2004-04-16 04:13:31
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31801/NHibernate/Mapping Modified Files: Column.cs Table.cs Log Message: Modified Alias so that only items that need to be Quoted will be quoted. See SimpleComponent.hbm.xml for quoting columns. Index: Table.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Table.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Table.cs 15 Apr 2004 09:30:15 -0000 1.12 --- Table.cs 16 Apr 2004 04:13:22 -0000 1.13 *************** *** 72,76 **** public string GetQuotedName(Dialect.Dialect dialect) { ! return dialect.QuoteForTableName(name); } --- 72,78 ---- public string GetQuotedName(Dialect.Dialect dialect) { ! return IsQuoted ? ! dialect.QuoteForTableName(name): ! name; } Index: Column.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Column.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Column.cs 15 Apr 2004 21:07:18 -0000 1.10 --- Column.cs 16 Apr 2004 04:13:22 -0000 1.11 *************** *** 56,60 **** public string GetQuotedName(Dialect.Dialect d) { ! return d.QuoteForColumnName(name); } --- 56,62 ---- public string GetQuotedName(Dialect.Dialect d) { ! return IsQuoted ? ! d.QuoteForColumnName(name) : ! name; } |
From: Michael D. <mik...@us...> - 2004-04-16 04:13:31
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31801/NHibernate/Sql Modified Files: Alias.cs Log Message: Modified Alias so that only items that need to be Quoted will be quoted. See SimpleComponent.hbm.xml for quoting columns. Index: Alias.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/Alias.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Alias.cs 15 Apr 2004 13:40:43 -0000 1.6 --- Alias.cs 16 Apr 2004 04:13:22 -0000 1.7 *************** *** 27,43 **** public string ToAliasString(string sqlIdentifier, Dialect.Dialect dialect) { ! if (dialect.UnQuote(sqlIdentifier) != sqlIdentifier) { ! sqlIdentifier = dialect.UnQuote(sqlIdentifier); } ! if ( sqlIdentifier.Length > length ) { ! sqlIdentifier = sqlIdentifier.Substring(0, length); } ! if (suffix!=null) sqlIdentifier += suffix; - return dialect.QuoteForAliasName(sqlIdentifier); } --- 27,58 ---- public string ToAliasString(string sqlIdentifier, Dialect.Dialect dialect) { ! bool isQuoted = dialect.IsQuoted(sqlIdentifier); ! string unquoted; ! ! if(isQuoted) { ! unquoted = dialect.UnQuote(sqlIdentifier); ! } ! else ! { ! unquoted = sqlIdentifier; } ! if ( unquoted.Length > length ) { ! unquoted = unquoted.Substring(0, length); } ! if (suffix!=null) unquoted += suffix; ! ! if ( isQuoted ) ! { ! return dialect.QuoteForAliasName(unquoted); ! } ! else ! { ! return unquoted; ! } } |
From: Michael D. <mik...@us...> - 2004-04-16 04:13:30
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31801/NHibernate.DomainModel Modified Files: SimpleComponent.hbm.xml Log Message: Modified Alias so that only items that need to be Quoted will be quoted. See SimpleComponent.hbm.xml for quoting columns. Index: SimpleComponent.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/SimpleComponent.hbm.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SimpleComponent.hbm.xml 10 Apr 2004 03:15:44 -0000 1.4 --- SimpleComponent.hbm.xml 16 Apr 2004 04:13:21 -0000 1.5 *************** *** 5,9 **** table="simp_com" > ! <id name="Key" type="Int64" column="id_" > <generator class="assigned" /> </id> --- 5,9 ---- table="simp_com" > ! <id name="Key" type="Int64" column="`i[d]_`" > <generator class="assigned" /> </id> *************** *** 11,15 **** <property name="Address" /> <property name="Count" column="count_" not-null="true" unique="true" /> ! <property name="Date" column="date_" /> <component name="Audit" class="NHibernate.DomainModel.AuditComponent, NHibernate.DomainModel"> <property name="CreatedUserId" column="created_user_id" /> --- 11,15 ---- <property name="Address" /> <property name="Count" column="count_" not-null="true" unique="true" /> ! <property name="Date" column="`d[at]e_`" /> <component name="Audit" class="NHibernate.DomainModel.AuditComponent, NHibernate.DomainModel"> <property name="CreatedUserId" column="created_user_id" /> |
From: Michael D. <mik...@us...> - 2004-04-15 21:07:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22207/Cfg Modified Files: Binder.cs Configuration.cs Log Message: Refactored the Dialect out of the StringHelper Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Binder.cs 15 Apr 2004 13:21:17 -0000 1.15 --- Binder.cs 15 Apr 2004 21:07:17 -0000 1.16 *************** *** 16,20 **** private static XmlNamespaceManager nsmgr; private static readonly string nsPrefix = "hbm"; ! private static Dialect.Dialect dialect; public static void BindClass(XmlNode node, PersistentClass model, Mappings mapping) { --- 16,20 ---- private static XmlNamespaceManager nsmgr; private static readonly string nsPrefix = "hbm"; ! internal static Dialect.Dialect dialect; public static void BindClass(XmlNode node, PersistentClass model, Mappings mapping) { *************** *** 111,117 **** } ! public static void BindRootClass(XmlNode node, RootClass model, Mappings mappings, Dialect.Dialect d) { ! ! dialect = d; BindClass(node, model, mappings); --- 111,115 ---- } ! public static void BindRootClass(XmlNode node, RootClass model, Mappings mappings) { BindClass(node, model, mappings); *************** *** 850,854 **** } ! public static void BindRoot(XmlDocument doc, Mappings model, Dialect.Dialect dialect) { XmlNode hmNode = doc.DocumentElement; --- 848,852 ---- } ! public static void BindRoot(XmlDocument doc, Mappings model) { XmlNode hmNode = doc.DocumentElement; *************** *** 870,874 **** foreach(XmlNode n in hmNode.SelectNodes(nsPrefix + ":class", nsmgr) ) { RootClass rootclass = new RootClass(); ! Binder.BindRootClass(n, rootclass, model, dialect); model.AddClass(rootclass); } --- 868,872 ---- foreach(XmlNode n in hmNode.SelectNodes(nsPrefix + ":class", nsmgr) ) { RootClass rootclass = new RootClass(); ! Binder.BindRootClass(n, rootclass, model); model.AddClass(rootclass); } Index: Configuration.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Configuration.cs 15 Apr 2004 13:21:17 -0000 1.11 --- Configuration.cs 15 Apr 2004 21:07:17 -0000 1.12 *************** *** 171,180 **** /// </summary> /// <param name="doc">The validated XmlDocument that contains the Mappings.</param> ! private void Add(XmlDocument doc) { try { ! StringHelper.Dialect = Dialect.Dialect.GetDialect(properties); ! Binder.BindRoot( doc, CreateMappings(), StringHelper.Dialect); } ! catch (MappingException me) { log.Error("Could not compile the mapping document", me); throw me; --- 171,183 ---- /// </summary> /// <param name="doc">The validated XmlDocument that contains the Mappings.</param> ! private void Add(XmlDocument doc) ! { try { ! Binder.dialect = Dialect.Dialect.GetDialect(properties); ! //StringHelper.Dialect = Dialect.Dialect.GetDialect(properties); ! Binder.BindRoot( doc, CreateMappings()); } ! catch (MappingException me) ! { log.Error("Could not compile the mapping document", me); throw me; |
From: Michael D. <mik...@us...> - 2004-04-15 21:07:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22207/Mapping Modified Files: Column.cs Log Message: Refactored the Dialect out of the StringHelper Index: Column.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Column.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Column.cs 15 Apr 2004 11:36:36 -0000 1.9 --- Column.cs 15 Apr 2004 21:07:18 -0000 1.10 *************** *** 70,73 **** --- 70,87 ---- } + public string Alias(Dialect.Dialect d, string suffix) + { + + if(quoted) + return "y" + uniqueInteger.ToString() + StringHelper.Underscore; + + if( (name.Length + suffix.Length) < 11 ) + return name + suffix; + //return name.Substring(0, name.Length - suffix.Length); + else + return (new Alias(10, uniqueInteger.ToString() + StringHelper.Underscore + suffix) ).ToAliasString(name, d); + + } + public bool IsNullable { |
From: Michael D. <mik...@us...> - 2004-04-15 21:07:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22207/Dialect Modified Files: Dialect.cs MsSql2000Dialect.cs MySQLDialect.cs Log Message: Refactored the Dialect out of the StringHelper Index: MsSql2000Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MsSql2000Dialect.cs 15 Apr 2004 13:21:18 -0000 1.9 --- MsSql2000Dialect.cs 15 Apr 2004 21:07:18 -0000 1.10 *************** *** 68,94 **** } ! public override string QuoteForTableName(string tableName) { ! if (tableName[0] == '[') return tableName; ! return "[" + tableName.Replace("]","]]") + "]"; } ! public override string QuoteForAliasName(string aliasName) { ! if (aliasName[0] == '[') return aliasName; ! return "[" + aliasName.Replace("]","]]") + "]"; } ! public override string QuoteForColumnName(string columnName) { ! if (columnName[0] == '[') return columnName; ! return "[" + columnName.Replace("]","]]") + "]"; } public override string UnQuote(string quoted) { ! if (quoted[0] == '[') quoted = quoted.Substring(1,quoted.Length - 2); ! return quoted.Replace("]]","]"); } --- 68,128 ---- } ! protected override char CloseQuote { ! get { return ']';} } ! protected override char OpenQuote { ! get { return '[';} } ! /// <summary> ! /// ! /// </summary> ! /// <param name="name"></param> ! /// <returns></returns> ! /// <remarks> ! /// MsSql does not require the OpenQuote to be escaped as long as the first char ! /// is an OpenQuote. ! /// </remarks> ! protected override string Quote(string name) { ! return OpenQuote + name.Replace(CloseQuote.ToString(), new string(CloseQuote, 2) ) + CloseQuote; } + // /// <summary> + // /// MsSql ov + // /// </summary> + // /// <param name="tableName"></param> + // /// <returns></returns> + // /// <remarks> + // /// MsSql needs to override it because it allows the ] to be a valid char + // /// in a table name. + // /// </remarks> + // public override string QuoteForTableName(string tableName) + // { + // if ( IsQuoted(tableName) ) return tableName; + // return Quote(tableName); // return OpenQuote + tableName.Replace(CloseQuote.ToString(), new string(CloseQuote, 2) ) + CloseQuote; + // } + // + // public override string QuoteForAliasName(string aliasName) + // { + // if ( IsQuoted(aliasName) ) return aliasName; + // return Quote(tableName); // return OpenQuote + aliasName.Replace(CloseQuote.ToString(), new string(CloseQuote, 2) ) + CloseQuote; + // } + // + // public override string QuoteForColumnName(string columnName) + // { + // if ( IsQuoted(columnName) ) return columnName; + // return Quote(tableName); // return OpenQuote + columnName.Replace(CloseQuote.ToString(), new string(CloseQuote, 2) ) + CloseQuote; + // } + public override string UnQuote(string quoted) { ! if ( IsQuoted(quoted) ) quoted = quoted.Substring(1,quoted.Length - 2); ! ! return quoted.Replace( new string(CloseQuote, 2), CloseQuote.ToString() ); } Index: Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/Dialect.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Dialect.cs 15 Apr 2004 13:21:18 -0000 1.26 --- Dialect.cs 15 Apr 2004 21:07:18 -0000 1.27 *************** *** 52,57 **** /// Characters used for quoting sql identifiers /// </summary> ! public const string Quote = "`'\"["; ! public const string ClosedQuote = "`'\"]"; /// <summary> --- 52,57 ---- /// Characters used for quoting sql identifiers /// </summary> ! public const string PossibleQuoteChars = "`'\"["; ! public const string PossibleClosedQuoteChars = "`'\"]"; /// <summary> *************** *** 425,430 **** /// The opening quote for a quoted identifier. /// </summary> ! [Obsolete("Should use Quote functions")] ! public virtual char OpenQuote { get { return '"'; } --- 425,430 ---- /// The opening quote for a quoted identifier. /// </summary> ! //[Obsolete("Should use Quote functions")] ! protected virtual char OpenQuote { get { return '"'; } *************** *** 434,439 **** /// The closing quote for a quoted identifier. /// </summary> ! [Obsolete("Should use Quote functions")] ! public virtual char CloseQuote { get { return '"'; } --- 434,439 ---- /// The closing quote for a quoted identifier. /// </summary> ! //[Obsolete("Should use Quote functions")] ! protected virtual char CloseQuote { get { return '"'; } *************** *** 725,745 **** /// <summary> /// Unquotes an already quoted name /// </summary> /// <param name="quoted">Quoted string</param> /// <returns>Unquoted string</returns> public virtual string UnQuote(string quoted) { return quoted; } /// <summary> /// Quotes a name for being used as a tablename /// </summary> /// <param name="tableName">Name of the table</param> ! /// <returns>Quoted name</returns> public virtual string QuoteForTableName(string tableName) { ! return tableName; } --- 725,797 ---- /// <summary> + /// Checks to see if the name has been quoted. + /// </summary> + /// <param name="name">The name to check if it is quoted</param> + /// <returns>true if name is already quoted.</returns> + /// <remarks> + /// The default implementation is to compare the first character + /// to Dialect.OpenQuote. + /// </remarks> + public virtual bool IsQuoted(string name) + { + //TODO: should we use regex here - performance implications + // or just live with the bug that if the first char in the name + // + return name[0]==OpenQuote; + } + + /// <summary> /// Unquotes an already quoted name /// </summary> /// <param name="quoted">Quoted string</param> /// <returns>Unquoted string</returns> + /// <remarks> + /// The Default implementation checks the first char to see if it is + /// == to OpenQuote and if so then it returns the string without the + /// first and last char. If this implementation is not sufficient for + /// your Dialect then it needs to be overridden. + /// </remarks> public virtual string UnQuote(string quoted) { + if (IsQuoted(quoted)) + return quoted.Substring(1, quoted.Length - 2); + return quoted; } /// <summary> + /// Unquotes an array of Quoted Names. + /// </summary> + /// <param name="quoted">strings to Unquote</param> + /// <returns>an array of unquoted strings.</returns> + /// <remarks> + /// This use UnQuote(string) for each string in the quoted array so + /// it should not need to be overridden - only UnQuote(string) needs + /// to be overridden unless this implementation is not sufficient. + /// </remarks> + public virtual string[] UnQuote(string[] quoted) + { + string[] unquoted = new string[ quoted.Length ]; + + for (int i=0; i<quoted.Length; i++) + unquoted[i] = UnQuote(quoted[i]); + + return unquoted; + } + + + + /// <summary> /// Quotes a name for being used as a tablename /// </summary> /// <param name="tableName">Name of the table</param> ! /// <returns>A Quoted name in the format of OpenQuote + tableName + CloseQuote</returns> ! /// <remarks></remarks> public virtual string QuoteForTableName(string tableName) { ! return IsQuoted(tableName) ? ! tableName : ! Quote(tableName); ! } *************** *** 749,756 **** /// <remarks>Original implementation calls <see cref="QuoteForTableName"/></remarks> /// <param name="columnName">Name of the column</param> ! /// <returns>Quoted name</returns> public virtual string QuoteForColumnName(string columnName) { ! return QuoteForTableName(columnName); } --- 801,831 ---- /// <remarks>Original implementation calls <see cref="QuoteForTableName"/></remarks> /// <param name="columnName">Name of the column</param> ! /// <returns>A Quoted name in the format of OpenQuote + columnName + CloseQuote</returns> public virtual string QuoteForColumnName(string columnName) { ! return IsQuoted(columnName) ? ! columnName : ! Quote(columnName); ! ! } ! ! /// <summary> ! /// Quotes a name. ! /// </summary> ! /// <param name="name">The string to Quote</param> ! /// <returns>A QuotedName </returns> ! protected virtual string Quote(string name) ! { ! string quotedName = name.Replace( OpenQuote.ToString(), new string(OpenQuote, 2) ); ! ! // in some dbs the Open and Close Quote are the same chars - if they are ! // then we don't have to escape the Close Quote char because we already ! // got it. ! if(OpenQuote!=CloseQuote) ! { ! quotedName = name.Replace( CloseQuote.ToString(), new string(CloseQuote, 2) ); ! } ! ! return OpenQuote + quotedName + CloseQuote; } *************** *** 760,769 **** /// <remarks>Original implementation calls <see cref="QuoteForTableName"/></remarks> /// <param name="columnName">Name of the alias</param> ! /// <returns>Quoted name</returns> public virtual string QuoteForAliasName(string aliasName) { ! return QuoteForTableName(aliasName); } public class CountQueryFunctionInfo : IQueryFunctionInfo { --- 835,848 ---- /// <remarks>Original implementation calls <see cref="QuoteForTableName"/></remarks> /// <param name="columnName">Name of the alias</param> ! /// <returns>A Quoted name in the format of OpenQuote + aliasName + CloseQuote</returns> public virtual string QuoteForAliasName(string aliasName) { ! return IsQuoted(aliasName) ? ! aliasName : ! Quote(aliasName); ! } + public class CountQueryFunctionInfo : IQueryFunctionInfo { Index: MySQLDialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MySQLDialect.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** MySQLDialect.cs 15 Apr 2004 11:36:35 -0000 1.14 --- MySQLDialect.cs 15 Apr 2004 21:07:18 -0000 1.15 *************** *** 51,54 **** --- 51,64 ---- + protected override char CloseQuote + { + get { return '`';} + } + + protected override char OpenQuote + { + get { return '`';} + } + public override string GetAddForeignKeyConstraintString(string constraintName, string[] foreignKey, string referencedTable, string[] primaryKey) { |
From: Michael D. <mik...@us...> - 2004-04-15 21:07:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22207/Persister Modified Files: NormalizedEntityPersister.cs Log Message: Refactored the Dialect out of the StringHelper Index: NormalizedEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/NormalizedEntityPersister.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** NormalizedEntityPersister.cs 15 Apr 2004 13:40:42 -0000 1.14 --- NormalizedEntityPersister.cs 15 Apr 2004 21:07:19 -0000 1.15 *************** *** 273,277 **** foreach(Column col in prop.ColumnCollection ) { propCols[columnIndex] = col.GetQuotedName(dialect); ! propAliases[columnIndex] = col.Alias(dialect) + tab.UniqueInteger + StringHelper.Underscore; columnIndex++; } --- 273,277 ---- foreach(Column col in prop.ColumnCollection ) { propCols[columnIndex] = col.GetQuotedName(dialect); ! propAliases[columnIndex] = col.Alias(dialect, tab.UniqueInteger.ToString() + StringHelper.Underscore); columnIndex++; } *************** *** 312,316 **** coltables.Add(tabnum); cols[l++] = col.GetQuotedName(dialect); ! aliases.Add( col.Alias(dialect) + tab.UniqueInteger + StringHelper.Underscore ); } propColumns.Add(cols); --- 312,316 ---- coltables.Add(tabnum); cols[l++] = col.GetQuotedName(dialect); ! aliases.Add( col.Alias(dialect, tab.UniqueInteger.ToString() + StringHelper.Underscore ) ); } propColumns.Add(cols); |
From: Michael D. <mik...@us...> - 2004-04-15 21:07:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22207/Util Modified Files: StringHelper.cs Log Message: Refactored the Dialect out of the StringHelper Index: StringHelper.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Util/StringHelper.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** StringHelper.cs 15 Apr 2004 13:21:19 -0000 1.10 --- StringHelper.cs 15 Apr 2004 21:07:19 -0000 1.11 *************** *** 15,19 **** public const string SqlParameter = "?"; ! public static Dialect.Dialect Dialect; [Obsolete("Use String.Join() instead of this method. It does the same thing")] --- 15,19 ---- public const string SqlParameter = "?"; ! // public static Dialect.Dialect Dialect; [Obsolete("Use String.Join() instead of this method. It does the same thing")] *************** *** 130,141 **** public static string Suffix(string name, string suffix) { ! if (suffix == null) ! return name; ! ! char quote = name[0]; ! if (UnQuote(name) != name) ! return Dialect.QuoteForColumnName(UnQuote(name) + suffix); ! else ! return Dialect.QuoteForColumnName(name + suffix); } --- 130,136 ---- public static string Suffix(string name, string suffix) { ! return (suffix == null) ? ! name : ! name + suffix; } *************** *** 194,213 **** return results; } ! ! public static string UnQuote(string name) { ! return Dialect.UnQuote(name); ! } ! ! public static void UnQuoteInPlace(string[] names) { ! for (int i=0; i<names.Length; i++) ! names[i] = UnQuote(names[i]); ! } ! ! public static string[] UnQuote(string[] names) { ! string[] unquoted = new string[ names.Length ]; ! for (int i=0; i<names.Length; i++) ! unquoted[i] = UnQuote(names[i]); ! return unquoted; ! } } } --- 189,213 ---- return results; } ! // ! // [Obsolete("Should directly call Dialect instead")] ! // public static string UnQuote(string name) { ! // return Dialect.UnQuote(name); ! // } ! // ! // [Obsolete("Should directly call Dialect instead")] ! // public static void UnQuoteInPlace(string[] names) ! // { ! // for (int i=0; i<names.Length; i++) ! // names[i] = UnQuote(names[i]); ! // } ! // ! // [Obsolete("Should directly call Dialect instead")] ! // public static string[] UnQuote(string[] names) ! // { ! // string[] unquoted = new string[ names.Length ]; ! // for (int i=0; i<names.Length; i++) ! // unquoted[i] = UnQuote(names[i]); ! // return unquoted; ! // } } } |
From: Michael D. <mik...@us...> - 2004-04-15 21:07:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22207/Collection Modified Files: CollectionPersister.cs Log Message: Refactored the Dialect out of the StringHelper Index: CollectionPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/CollectionPersister.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** CollectionPersister.cs 15 Apr 2004 11:36:35 -0000 1.17 --- CollectionPersister.cs 15 Apr 2004 21:07:18 -0000 1.18 *************** *** 129,133 **** } } ! unquotedElementColumnNames = StringHelper.UnQuote(elementColumnNames); if ( hasIndex = collection.IsIndexed ) { --- 129,133 ---- } } ! unquotedElementColumnNames = dialect.UnQuote(elementColumnNames); //StringHelper.UnQuote(elementColumnNames); if ( hasIndex = collection.IsIndexed ) { *************** *** 143,147 **** rowSelectColumnNames = indexColumnNames; rowSelectType = indexType; ! unquotedIndexColumnNames = StringHelper.UnQuote(indexColumnNames); } else { indexType = null; --- 143,147 ---- rowSelectColumnNames = indexColumnNames; rowSelectType = indexType; ! unquotedIndexColumnNames = dialect.UnQuote(indexColumnNames); // StringHelper.UnQuote(indexColumnNames); } else { indexType = null; |
From: Peter S. <sz...@us...> - 2004-04-15 15:53:50
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14532/NHibernate/Loader Modified Files: CriteriaLoader.cs Log Message: Fixed Order by error... Index: CriteriaLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/CriteriaLoader.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CriteriaLoader.cs 2 Apr 2004 15:55:48 -0000 1.4 --- CriteriaLoader.cs 15 Apr 2004 15:53:40 -0000 1.5 *************** *** 45,49 **** { //TODO: H2.0.3 - this is not in H2.0.3 - where did it move to? ! if(orderByNeeded) orderByBuilder.Append(" ORDER BY "); orderByNeeded = false; --- 45,49 ---- { //TODO: H2.0.3 - this is not in H2.0.3 - where did it move to? ! //if(orderByNeeded) orderByBuilder.Append(" ORDER BY "); orderByNeeded = false; |
From: Peter S. <sz...@us...> - 2004-04-15 15:53:50
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14532/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Fixed Order by error... Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** FooBarTest.cs 15 Apr 2004 15:38:02 -0000 1.11 --- FooBarTest.cs 15 Apr 2004 15:53:41 -0000 1.12 *************** *** 71,85 **** { ISession s = sessions.OpenSession(); Baz b = new Baz(); IDictionary ss = new Hashtable(); ! ss.Add(b, new Sortable[] {new Sortable("foo") }); ! // ss.Add(b, new Sortable("bar") ); ! // ss.Add(b, new Sortable("baz") ); b.sortablez = ss; s.Save(b); s.Flush(); s.Close(); s = sessions.OpenSession(); IList result = s.CreateCriteria(typeof(Baz)) .AddOrder( Expression.Order.Asc("name") ) --- 71,88 ---- { ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); Baz b = new Baz(); IDictionary ss = new Hashtable(); ! ss.Add(new Sortable("foo"), null); ! ss.Add(new Sortable("bar"), null); ! ss.Add(new Sortable("baz"), null); b.sortablez = ss; s.Save(b); s.Flush(); + t.Commit(); s.Close(); s = sessions.OpenSession(); + t = s.BeginTransaction(); IList result = s.CreateCriteria(typeof(Baz)) .AddOrder( Expression.Order.Asc("name") ) *************** *** 89,92 **** --- 92,96 ---- Assert.AreEqual( ( (Sortable) b.sortablez[0] ).name, "bar" ); s.Flush(); + t.Commit(); s.Close(); } |
From: Peter S. <sz...@us...> - 2004-04-15 15:38:14
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11126/NHibernate.Test Modified Files: FooBarTest.cs Log Message: None of the foobar tests are running :( Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** FooBarTest.cs 15 Apr 2004 15:11:01 -0000 1.10 --- FooBarTest.cs 15 Apr 2004 15:38:02 -0000 1.11 *************** *** 35,39 **** [Test] ! //[Ignore("Generated SQL contains bad quoting")] public void FetchInitializedCollection() { --- 35,39 ---- [Test] ! [Ignore("don't know how to get aliased name for baz")] public void FetchInitializedCollection() { *************** *** 67,70 **** --- 67,71 ---- [Test] + [Ignore("unknown problem")] public void Sortables() { *************** *** 73,78 **** IDictionary ss = new Hashtable(); ss.Add(b, new Sortable[] {new Sortable("foo") }); ! // ss.Add(b, new Sortable("bar") ); ! // ss.Add(b, new Sortable("baz") ); b.sortablez = ss; s.Save(b); --- 74,79 ---- IDictionary ss = new Hashtable(); ss.Add(b, new Sortable[] {new Sortable("foo") }); ! // ss.Add(b, new Sortable("bar") ); ! // ss.Add(b, new Sortable("baz") ); b.sortablez = ss; s.Save(b); *************** *** 91,94 **** --- 92,162 ---- } + [Test] + [Ignore("don't know how to get aliased name for bazid")] + public void FetchList() + { + ISession s = sessions.OpenSession(); + Baz baz = new Baz(); + s.Save(baz); + Foo foo = new Foo(); + s.Save(foo); + Foo foo2 = new Foo(); + s.Save(foo2); + s.Flush(); + IList list = new ArrayList(); + for ( int i=0; i<5; i++ ) + { + Fee fee = new Fee(); + list.Add(fee); + } + baz.fees = list; + list = s.Find("from Foo foo, Baz baz left join fetch baz.fees"); + Assert.IsTrue( NHibernate.IsInitialized( ( (Baz) ( (object[]) list[0] )[1] ).fees ) ); + s.Delete(foo); + s.Delete(foo2); + s.Delete(baz); + s.Flush(); + s.Close(); + } + + [Test] + [Ignore("unknown problem")] + public void BagOneToMany() + { + ISession s = sessions.OpenSession(); + Baz baz = new Baz(); + IList list = new ArrayList(); + baz.bazez =list; + list.Add( new Baz() ); + s.Save(baz); + s.Flush(); + list.Add( new Baz() ); + s.Flush(); + list.Insert( 0, new Baz() ); + s.Flush(); + object toDelete = list[1]; + list.RemoveAt(1); + s.Delete( toDelete ); + s.Flush(); + s.Delete(baz); + s.Flush(); + s.Close(); + } + + [Test] + [Ignore("won't work without proxy")] + public void SaveDelete() + { + ISession s = sessions.OpenSession(); + Foo f = new Foo(); + s.Save(f); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + s.Delete( s.Load( typeof(Foo), f.key ) ); + s.Flush(); + s.Close(); + } } } |
From: Peter S. <sz...@us...> - 2004-04-15 15:11:26
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4835/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Does <set> work? Expects IDictionary, in original expected TreeSet, which is IList. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FooBarTest.cs 15 Apr 2004 09:30:16 -0000 1.9 --- FooBarTest.cs 15 Apr 2004 15:11:01 -0000 1.10 *************** *** 35,39 **** [Test] ! //[Ignore("Generated SQL contains bad quoting")] public void FetchInitializedCollection() { --- 35,39 ---- [Test] ! //[Ignore("Generated SQL contains bad quoting")] public void FetchInitializedCollection() { *************** *** 66,69 **** --- 66,94 ---- } + [Test] + public void Sortables() + { + ISession s = sessions.OpenSession(); + Baz b = new Baz(); + IDictionary ss = new Hashtable(); + ss.Add(b, new Sortable[] {new Sortable("foo") }); + // ss.Add(b, new Sortable("bar") ); + // ss.Add(b, new Sortable("baz") ); + b.sortablez = ss; + s.Save(b); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + IList result = s.CreateCriteria(typeof(Baz)) + .AddOrder( Expression.Order.Asc("name") ) + .List(); + b = (Baz) result[0]; + Assert.IsTrue( b.sortablez.Count==3 ); + Assert.AreEqual( ( (Sortable) b.sortablez[0] ).name, "bar" ); + s.Flush(); + s.Close(); + } + } } |
From: Peter S. <sz...@us...> - 2004-04-15 13:40:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18398/NHibernate/Persister Modified Files: NormalizedEntityPersister.cs Log Message: Looks like fixed the alias thing. Index: NormalizedEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/NormalizedEntityPersister.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** NormalizedEntityPersister.cs 15 Apr 2004 11:36:36 -0000 1.13 --- NormalizedEntityPersister.cs 15 Apr 2004 13:40:42 -0000 1.14 *************** *** 1179,1183 **** private string Alias(string name, int tableNumber) { if (tableNumber==0) return name; ! return name + StringHelper.Underscore + tableNumber; } --- 1179,1183 ---- private string Alias(string name, int tableNumber) { if (tableNumber==0) return name; ! return dialect.QuoteForAliasName(dialect.UnQuote(name) + StringHelper.Underscore + tableNumber); } |
From: Peter S. <sz...@us...> - 2004-04-15 13:40:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18398/NHibernate/Sql Modified Files: Alias.cs Log Message: Looks like fixed the alias thing. Index: Alias.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/Alias.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Alias.cs 15 Apr 2004 13:21:18 -0000 1.5 --- Alias.cs 15 Apr 2004 13:40:43 -0000 1.6 *************** *** 27,77 **** public string ToAliasString(string sqlIdentifier, Dialect.Dialect dialect) { ! return dialect.QuoteForAliasName(sqlIdentifier); ! char begin = sqlIdentifier[0]; ! int quoteType = Dialect.Dialect.Quote.IndexOf(begin); ! ! string unquoted; ! ! if ( quoteType>=0 ) ! { ! unquoted = sqlIdentifier.Substring(1, sqlIdentifier.Length-1 ); ! } ! else { ! unquoted = sqlIdentifier; } ! if ( unquoted.Length > length ) { ! unquoted = unquoted.Substring(0, length); } ! if (suffix!=null) unquoted += suffix; ! if ( quoteType >= 0 ) ! { ! char endQuote = Dialect.Dialect.ClosedQuote[quoteType]; ! return begin + unquoted + endQuote; ! } ! else ! { ! return unquoted; ! } } public string ToUnquotedAliasString(string sqlIdentifier, Dialect.Dialect dialect) { ! char begin = sqlIdentifier[0]; ! int quoteType = Dialect.Dialect.Quote.IndexOf(begin); ! string unquoted; ! ! if(quoteType >= 0) ! { ! unquoted = sqlIdentifier.Substring(1, sqlIdentifier.Length - 2); ! } ! else ! { ! unquoted = sqlIdentifier; ! } if(unquoted.Length > length) --- 27,48 ---- public string ToAliasString(string sqlIdentifier, Dialect.Dialect dialect) { ! if (dialect.UnQuote(sqlIdentifier) != sqlIdentifier) { ! sqlIdentifier = dialect.UnQuote(sqlIdentifier); } ! if ( sqlIdentifier.Length > length ) { ! sqlIdentifier = sqlIdentifier.Substring(0, length); } ! if (suffix!=null) sqlIdentifier += suffix; ! return dialect.QuoteForAliasName(sqlIdentifier); } public string ToUnquotedAliasString(string sqlIdentifier, Dialect.Dialect dialect) { ! string unquoted = dialect.UnQuote(sqlIdentifier); if(unquoted.Length > length) |