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-08-20 17:39:12
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17702 Modified Files: NHibernate-1.1.csproj Log Message: Moved QuerySelect to SqlCommand folder and removed all "using NHibernate.Sql" because that namespace has been completely refactored to SqlCommand. There were also some classes with the using that had no reason to have a "using NHibernate.SqlCommand;" Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** NHibernate-1.1.csproj 20 Aug 2004 02:34:20 -0000 1.36 --- NHibernate-1.1.csproj 20 Aug 2004 17:39:03 -0000 1.37 *************** *** 1343,1351 **** BuildAction = "Compile" /> ! <File ! RelPath = "Sql\QuerySelect.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> <File RelPath = "SqlCommand\Alias.cs" --- 1343,1347 ---- BuildAction = "Compile" /> ! <Folder RelPath = "Sql\" /> <File RelPath = "SqlCommand\Alias.cs" *************** *** 1424,1427 **** --- 1420,1428 ---- /> <File + RelPath = "SqlCommand\QuerySelect.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "SqlCommand\SelectFragment.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-08-20 17:39:12
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17702/SqlCommand Modified Files: ForUpdateFragment.cs Log Message: Moved QuerySelect to SqlCommand folder and removed all "using NHibernate.Sql" because that namespace has been completely refactored to SqlCommand. There were also some classes with the using that had no reason to have a "using NHibernate.SqlCommand;" Index: ForUpdateFragment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand/ForUpdateFragment.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ForUpdateFragment.cs 30 Apr 2004 14:06:47 -0000 1.4 --- ForUpdateFragment.cs 20 Aug 2004 17:39:02 -0000 1.5 *************** *** 3,7 **** using System.Text; - using NHibernate.Sql; using NHibernate.Util; --- 3,6 ---- |
From: Michael D. <mik...@us...> - 2004-08-20 17:39:11
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17702/Loader Modified Files: CollectionLoader.cs EntityLoader.cs Log Message: Moved QuerySelect to SqlCommand folder and removed all "using NHibernate.Sql" because that namespace has been completely refactored to SqlCommand. There were also some classes with the using that had no reason to have a "using NHibernate.SqlCommand;" Index: CollectionLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/CollectionLoader.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CollectionLoader.cs 16 Aug 2004 05:26:39 -0000 1.8 --- CollectionLoader.cs 20 Aug 2004 17:39:02 -0000 1.9 *************** *** 6,10 **** using NHibernate.Engine; using NHibernate.Persister; - using NHibernate.Sql; using NHibernate.SqlCommand; using NHibernate.Type; --- 6,9 ---- Index: EntityLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/EntityLoader.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EntityLoader.cs 2 Apr 2004 15:55:48 -0000 1.4 --- EntityLoader.cs 20 Aug 2004 17:39:02 -0000 1.5 *************** *** 6,10 **** using NHibernate.Engine; using NHibernate.Persister; - using NHibernate.Sql; using NHibernate.SqlCommand; using NHibernate.Type; --- 6,9 ---- |
From: Michael D. <mik...@us...> - 2004-08-20 15:34:16
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25261/NHibernate.Test Modified Files: FumTest.cs MasterDetailTest.cs Log Message: Fixed the tests that were failing because of Hql problems. Index: MasterDetailTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MasterDetailTest.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** MasterDetailTest.cs 16 Aug 2004 05:15:10 -0000 1.11 --- MasterDetailTest.cs 20 Aug 2004 15:34:05 -0000 1.12 *************** *** 115,119 **** [Test] ! [Ignore("HQL bugs - http://jira.nhibernate.org:8080/browse/NH-79, http://jira.nhibernate.org:8080/browse/NH-80")] public void MasterDetail() { --- 115,119 ---- [Test] ! [Ignore("HQL bugs - http://jira.nhibernate.org:8080/browse/NH-79")] public void MasterDetail() { *************** *** 205,209 **** - // rest of the test depends on ISession.Filter() working s = sessions.OpenSession(); t = s.BeginTransaction(); --- 205,208 ---- *************** *** 213,218 **** Assert.AreEqual( 2, s.Filter( master.Details, "order by this.I desc").Count ); Assert.AreEqual( 2, s.Filter( master.Details, "select this where this.id > -1").Count ); ! /* ! * TODO: Filter is not working well... IQuery q = s.CreateFilter( master.Details, "where this.id > :id" ); q.SetInt32("id", -1); --- 212,216 ---- Assert.AreEqual( 2, s.Filter( master.Details, "order by this.I desc").Count ); Assert.AreEqual( 2, s.Filter( master.Details, "select this where this.id > -1").Count ); ! IQuery q = s.CreateFilter( master.Details, "where this.id > :id" ); q.SetInt32("id", -1); *************** *** 234,246 **** Assert.AreEqual( 1, q.List().Count ); Assert.IsTrue( q.Enumerable().GetEnumerator().MoveNext() ); ! */ Assert.AreEqual( 2, s.Filter( master.Details, "where this.id > -1").Count ); Assert.AreEqual( 2, s.Filter( master.Details, "select this.Master where this.id > -1").Count ); Assert.AreEqual( 2, s.Filter( master.Details, "select m from m in class Master where this.id > -1 and this.Master=m").Count ); ! Assert.AreEqual( 0, s.Filter( master.Incoming.Keys, "where this.id > -1 and this.Name is not null").Count ); } --- 232,294 ---- Assert.AreEqual( 1, q.List().Count ); Assert.IsTrue( q.Enumerable().GetEnumerator().MoveNext() ); ! Assert.AreEqual( 2, s.Filter( master.Details, "where this.id > -1").Count ); Assert.AreEqual( 2, s.Filter( master.Details, "select this.Master where this.id > -1").Count ); Assert.AreEqual( 2, s.Filter( master.Details, "select m from m in class Master where this.id > -1 and this.Master=m").Count ); ! Assert.AreEqual( 0, s.Filter( master.Incoming, "where this.id > -1 and this.Name is not null").Count ); ! ! IQuery filter = s.CreateFilter( master.Details, "select max(this.I)"); ! enumer = filter.Enumerable().GetEnumerator(); ! Assert.IsTrue( enumer.MoveNext() ); ! Assert.IsTrue( enumer.Current is Int32 ); ! ! filter = s.CreateFilter( master.Details, "select max(this.I) group by this.id" ); ! enumer = filter.Enumerable().GetEnumerator(); ! Assert.IsTrue( enumer.MoveNext() ); ! Assert.IsTrue( enumer.Current is Int32 ); ! ! filter = s.CreateFilter( master.Details, "select count(*)" ); ! enumer = filter.Enumerable().GetEnumerator(); ! Assert.IsTrue( enumer.MoveNext() ); ! Assert.IsTrue( enumer.Current is Int32 ); ! ! Assert.AreEqual( 2, s.CreateFilter( master.Details, "select this.Master" ).List().Count ); ! ! IQuery f = s.CreateFilter( master.Details, "select max(this.I) where this.I < :top and this.I>=:bottom" ); ! f.SetInt32("top", 100); ! f.SetInt32("bottom", 0); + enumer = f.Enumerable().GetEnumerator(); + Assert.IsTrue( enumer.MoveNext() ); + Assert.AreEqual( 12, enumer.Current ); + + f.SetInt32("top", 2); + enumer = f.Enumerable().GetEnumerator(); + Assert.IsTrue( enumer.MoveNext() ); + Assert.AreEqual( 0, enumer.Current ); + + f = s.CreateFilter( master.Details, "select max(this.I) where this.I not in (:list)" ); + IList coll = new ArrayList(); + coll.Add(-666); + coll.Add(22); + coll.Add(0); + f.SetParameterList("list", coll); + enumer = f.Enumerable().GetEnumerator(); + Assert.IsTrue( enumer.MoveNext() ); + Assert.AreEqual( 12, enumer.Current ); + i = 0; + foreach( Detail d in master.Details.Keys ) + { + Assert.AreSame( master, d.Master, "master-detail" ); + s.Delete(d); + i++; + } + Assert.AreEqual( 2, i, "master-detail" ); + s.Delete(master); + t.Commit(); + s.Close(); } Index: FumTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FumTest.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** FumTest.cs 14 Aug 2004 14:57:48 -0000 1.12 --- FumTest.cs 20 Aug 2004 15:34:05 -0000 1.13 *************** *** 193,197 **** [Test] - [Ignore("Filter() and multi-column Types. Everything else passes. http://jira.nhibernate.org:8080/browse/NH-96")] public void CompositeIDQuery() { --- 193,196 ---- *************** *** 257,261 **** fum = (Fum)s.Load( typeof(Fum), fum.Id ); - //TODO: http://jira.nhibernate.org:8080/browse/NH-96 bug is here s.Filter( fum.QuxArray, "where this.Foo is null" ); s.Filter( fum.QuxArray, "where this.Foo.id = ?", "fooid", NHibernate.String ); --- 256,259 ---- |
From: Michael D. <mik...@us...> - 2004-08-20 15:33:00
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24849/NHibernate/Impl Modified Files: QueryImpl.cs Log Message: Accidentally checked in when there was still commented out code that should have been removed. Index: QueryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/QueryImpl.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** QueryImpl.cs 20 Aug 2004 15:27:37 -0000 1.12 --- QueryImpl.cs 20 Aug 2004 15:32:48 -0000 1.13 *************** *** 304,308 **** foreach(object obj in vals) { - // SetParameterList(name, vals, GuessType( obj.GetType() ) ); SetParameterList(name, vals, GuessType(obj) ); break; // fairly hackish...need the type of the first object --- 304,307 ---- |
From: Michael D. <mik...@us...> - 2004-08-20 15:31:49
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24569/NHibernate/Hql Modified Files: QueryTranslator.cs Log Message: Refactored QueryTranslator to remove the need for the HACK to check the type of Loader. Index: QueryTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/QueryTranslator.cs,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** QueryTranslator.cs 19 Aug 2004 17:46:38 -0000 1.39 --- QueryTranslator.cs 20 Aug 2004 15:31:37 -0000 1.40 *************** *** 928,932 **** SqlString sqlWithLock = ApplyLocks(SqlString, lockModes, session.Factory.Dialect); ! IDbCommand st = PrepareQueryStatement( sqlWithLock, values, types, namedParams, selection, false, session); --- 928,932 ---- SqlString sqlWithLock = ApplyLocks(SqlString, lockModes, session.Factory.Dialect); ! IDbCommand st = PrepareCommand( sqlWithLock, values, types, namedParams, selection, false, session); *************** *** 1252,1351 **** } /// <summary> ! /// Obtain an <see cref="IDbCommand"/> and bind the parameters. /// </summary> ! /// <param name="sql">A string containing the Sql statement</param> ! /// <param name="values">The values to put in the Parameters.</param> ! /// <param name="types">The IType to use to put the values in the Parameters.</param> ! /// <param name="selection"></param> ! /// <param name="scroll"></param> ! /// <param name="session">The ISession currently in.</param> ! /// <returns>An IDbCommand that is ready for execution.</returns> /// <remarks> ! /// <para> ! /// This is used to convert an Hql sql string into a SqlString and then finally into an IDbCommand ! /// that has been prepared. ! /// </para> ! /// <para> ! /// This should not be considered a permanent solution. While parsing the HQL we should be building ! /// a SqlString, not a string that contains sql... ! /// </para> ! /// <para> ! /// This used to be in the Loader, but since the only use of this right now is in the QueryTranslator ! /// I moved it into here. ! /// </para> /// </remarks> ! protected override IDbCommand PrepareQueryStatement(string sql, object[] values, IType[] types, IDictionary namedParams, RowSelection selection, bool scroll, ISessionImplementor session) ! { ! return PrepareQueryStatement( new SqlString(sql), values, types, namedParams, selection, scroll, session); ! } ! ! protected override IDbCommand PrepareQueryStatement(SqlString sql, object[] values, IType[] types, IDictionary namedParams, RowSelection selection, bool scroll, ISessionImplementor session) { ! IType[] paramTypes = null; ! object[] paramValues = null; ! if(namedParams==null || namedParams.Count==0) { ! paramTypes = types; ! paramValues = values; } else { - // convert the named parameters to an array of values and types - ArrayList paramTypeList = new ArrayList(namedParams.Keys.Count); - ArrayList paramValueList = new ArrayList(namedParams.Keys.Count); - - // assumes that types are all of span 1 - foreach (DictionaryEntry e in namedParams) - { - string name = (string) e.Key; - TypedValue typedval = (TypedValue) e.Value; - int[] locs = GetNamedParameterLocs(name); ! for (int i = 0; i < locs.Length; i++) { ! int lastInsertedIndex = paramTypeList.Count; ! int insertAt = locs[i]; ! // need to make sure that the ArrayList is populated with null objects ! // up to the index we are about to add the values into. An Index Out ! // of Range exception will be thrown if we add an element at an index ! // that is greater than the Count. ! if(insertAt >= lastInsertedIndex) { ! for(int j = lastInsertedIndex; j <= insertAt; j++) { ! paramTypeList.Add(null); ! paramValueList.Add(null); } } ! paramTypeList[insertAt] = typedval.Type; ! paramValueList[insertAt] = typedval.Value; } - } - paramTypes = (IType[]) paramTypeList.ToArray( typeof(IType) ); - paramValues = (object[]) paramValueList.ToArray( typeof(object) ); } ! ! SqlStringBuilder hqlBuilder = new SqlStringBuilder(sql); ! int paramIndex = 0; ! for( int i=0; i<hqlBuilder.Count; i++ ) ! { ! Parameter partParam = hqlBuilder[i] as Parameter; ! if(partParam!=null) ! { ! Parameter param = Parameter.GenerateParameters(session.Factory, new string[] {paramIndex.ToString()}, paramTypes[paramIndex])[0]; ! hqlBuilder[i] = param; ! paramIndex++; ! } ! } ! ! return PrepareCommand(hqlBuilder.ToSqlString(), paramValues, paramTypes, null, selection, scroll, session); } } --- 1252,1383 ---- } + /// <summary> ! /// Creates an IDbCommand object and populates it with the values necessary to execute it against the ! /// database to Load an Entity. /// </summary> ! /// <param name="sqlString">The SqlString to convert into a prepared IDbCommand.</param> ! /// <param name="values">The values that should be bound to the parameters in the IDbCommand</param> ! /// <param name="types">The IType for the value</param> ! /// <param name="namedParams">The HQL named parameters.</param> ! /// <param name="selection">The RowSelection to help setup the CommandTimeout</param> ! /// <param name="scroll">TODO: find out where this is used...</param> ! /// <param name="session">The SessionImpl this Command is being prepared in.</param> ! /// <returns>An IDbCommand that is ready to be executed.</returns> /// <remarks> ! /// This ensures that the SqlString does not contained any parameters that don't have a SqlType ! /// set. During Hql parsing the SqlType is not set and a Parameter "placeholder" is added to ! /// the SqlString. If there are any untyped parameters this replaces them using the types and ! /// namedParams parameters. /// </remarks> ! protected override IDbCommand PrepareCommand(SqlString sqlString, object[] values, IType[] types, IDictionary namedParams, RowSelection selection, bool scroll, ISessionImplementor session) { ! SqlString sql = null; ! // when there is no untyped Parameters then we can avoid the need to create ! // a new sql string and just return the existing one because it is ready ! // to be prepared and executed. ! if(sqlString.ContainsUntypedParameter==false) { ! sql = sqlString; } else { ! // holds the index of the sqlPart that should be replaced ! int sqlPartIndex = 0; ! ! // holds the index of the paramIndexes array that is the current position ! int paramIndex = 0; ! ! sql = sqlString.Clone(); ! int[] paramIndexes = sql.ParameterIndexes; ! ! // if there are no Parameters in the SqlString then there is no reason to ! // bother with this code. ! if( paramIndexes.Length > 0 ) ! { ! ! for( int i=0; i<types.Length; i++ ) { ! string[] colNames = new string[types[i].GetColumnSpan(factory)]; ! for( int j=0; j<colNames.Length; j++ ) ! { ! colNames[j] = "p" + paramIndex.ToString() + j.ToString(); ! } ! Parameter[] parameters = Parameter.GenerateParameters( factory, colNames , types[i] ); ! ! foreach(Parameter param in parameters) ! { ! sqlPartIndex = paramIndexes[paramIndex]; ! sql.SqlParts[sqlPartIndex] = param; ! paramIndex++; ! } ! } ! ! if( namedParams!=null && namedParams.Count > 0 ) ! { ! // convert the named parameters to an array of types ! ArrayList paramTypeList = new ArrayList(); ! ! foreach( DictionaryEntry e in namedParams ) { ! string name = (string) e.Key; ! TypedValue typedval = (TypedValue) e.Value; ! int[] locs = GetNamedParameterLocs(name); ! ! for( int i=0; i<locs.Length; i++ ) { ! int lastInsertedIndex = paramTypeList.Count; ! ! int insertAt = locs[i]; ! ! // need to make sure that the ArrayList is populated with null objects ! // up to the index we are about to add the values into. An Index Out ! // of Range exception will be thrown if we add an element at an index ! // that is greater than the Count. ! if(insertAt >= lastInsertedIndex) ! { ! for(int j=lastInsertedIndex; j<=insertAt; j++) ! { ! paramTypeList.Add(null); ! } ! } ! ! paramTypeList[insertAt] = typedval.Type; } } + + for( int i=0; i<paramTypeList.Count; i++ ) + { + IType type = (IType)paramTypeList[i]; + string[] colNames = new string[type.GetColumnSpan(factory)]; + + for( int j=0; j<colNames.Length; j++ ) + { + colNames[j] = "p" + paramIndex.ToString() + j.ToString(); + } + + Parameter[] parameters = Parameter.GenerateParameters( factory, colNames , type ); + + foreach(Parameter param in parameters) + { + sqlPartIndex = paramIndexes[paramIndex]; + sql.SqlParts[sqlPartIndex] = param; ! paramIndex++; ! } ! } } } } ! // replace the local field used by the SqlString property with the one we just built ! // that has the correct parameters ! this.sqlString = sql; ! return base.PrepareCommand(sql, values, types, namedParams, selection, scroll, session); } } |
From: Michael D. <mik...@us...> - 2004-08-20 15:31:47
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24569/NHibernate/Loader Modified Files: Loader.cs Log Message: Refactored QueryTranslator to remove the need for the HACK to check the type of Loader. Index: Loader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/Loader.cs,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Loader.cs 19 Aug 2004 17:49:59 -0000 1.28 --- Loader.cs 20 Aug 2004 15:31:37 -0000 1.29 *************** *** 161,184 **** IList results = new ArrayList(); - // TODO: this point would be where we build the Command object - need to look at the - // other classes to see what there sql building looks like... - //HACK: this is here until we get every loader moved over to commands... IDbCommand st = null; ! if( this.GetType()!=typeof(Hql.QueryTranslator) && this.GetType()!=typeof(Hql.FilterTranslator) ) ! { ! st = PrepareCommand( ! ApplyLocks(SqlString, lockModes, session.Factory.Dialect), ! values, types, namedParams, selection, false, session); ! } ! else ! { ! // it is okay to convert to and from a string to SqlString and back to a string ! // because there are no parameters in the SqlString - even though there are parameters ! // in the string that contains sql. SqlString will not parse out parameters - it assumes ! // a string passed to it is a string. ! st = PrepareQueryStatement( ! ApplyLocks(SqlString, lockModes, session.Factory.Dialect) ! , values, types, namedParams, selection, false, session ); ! } IDataReader rs = GetResultSet(st, selection, session); --- 161,170 ---- IList results = new ArrayList(); IDbCommand st = null; ! ! st = PrepareCommand( ! ApplyLocks(SqlString, lockModes, session.Factory.Dialect), ! values, types, namedParams, selection, false, session); ! IDataReader rs = GetResultSet(st, selection, session); *************** *** 572,575 **** --- 558,562 ---- } + [Obsolete("Use PrepareCommand instead")] protected virtual IDbCommand PrepareQueryStatement(string sql, object[] values, IType[] types, IDictionary namedParams, RowSelection selection, bool scroll, ISessionImplementor session) { *************** *** 579,582 **** --- 566,570 ---- } + [Obsolete("Use PrepareCommand instead")] protected virtual IDbCommand PrepareQueryStatement(SqlString sql, object[] values, IType[] types, IDictionary namedParams, RowSelection selection, bool scroll, ISessionImplementor session) { *************** *** 598,605 **** /// <param name="session">The SessionImpl this Command is being prepared in.</param> /// <returns>An IDbCommand that is ready to be executed.</returns> ! protected IDbCommand PrepareCommand(SqlString sqlString, object[] values, IType[] types, IDictionary namedParams, RowSelection selection, bool scroll, ISessionImplementor session) { Dialect.Dialect dialect = session.Factory.Dialect; ! bool useLimit = UseLimit(selection, dialect); bool scrollable = session.Factory.UseScrollableResultSets && ( --- 586,593 ---- /// <param name="session">The SessionImpl this Command is being prepared in.</param> /// <returns>An IDbCommand that is ready to be executed.</returns> ! protected virtual IDbCommand PrepareCommand(SqlString sqlString, object[] values, IType[] types, IDictionary namedParams, RowSelection selection, bool scroll, ISessionImplementor session) { Dialect.Dialect dialect = session.Factory.Dialect; ! bool useLimit = UseLimit(selection, dialect); bool scrollable = session.Factory.UseScrollableResultSets && ( |
From: Michael D. <mik...@us...> - 2004-08-20 15:27:46
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23721/NHibernate/Impl Modified Files: QueryImpl.cs Log Message: Fixed problem with IN parameters. Index: QueryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/QueryImpl.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** QueryImpl.cs 16 Aug 2004 05:21:44 -0000 1.11 --- QueryImpl.cs 20 Aug 2004 15:27:37 -0000 1.12 *************** *** 85,89 **** public IQuery SetParameter(string name, object val, IType type) { ! namedParameters.Add(name, new TypedValue(type, val)); return this; } --- 85,89 ---- public IQuery SetParameter(string name, object val, IType type) { ! namedParameters[name] = new TypedValue(type, val); return this; } *************** *** 302,307 **** public IQuery SetParameterList(string name, ICollection vals) { ! foreach(object obj in vals) { ! SetParameterList(name, vals, GuessType( obj.GetType() ) ); break; // fairly hackish...need the type of the first object } --- 302,309 ---- public IQuery SetParameterList(string name, ICollection vals) { ! foreach(object obj in vals) ! { ! // SetParameterList(name, vals, GuessType( obj.GetType() ) ); ! SetParameterList(name, vals, GuessType(obj) ); break; // fairly hackish...need the type of the first object } |
From: Michael D. <mik...@us...> - 2004-08-20 15:26:34
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SqlCommandTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23509/NHibernate.Test/SqlCommandTest Modified Files: SqlStringFixture.cs Log Message: Added methods to SqlString and tests for them. Index: SqlStringFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SqlCommandTest/SqlStringFixture.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SqlStringFixture.cs 18 Aug 2004 20:15:04 -0000 1.2 --- SqlStringFixture.cs 20 Aug 2004 15:26:23 -0000 1.3 *************** *** 33,76 **** } ! [Test] ! public void EndsWith() ! { ! SqlString sql = new SqlString( new string[] {"select", " from table" } ); ! Assert.IsTrue( sql.EndsWith("ble") ); ! Assert.IsFalse( sql.EndsWith("'") ); ! } ! ! [Test] ! public void EndsWithEmptyString() ! { ! SqlString sql = new SqlString( new string[] { "", "select", " from table", "" } ); ! Assert.IsTrue( sql.EndsWith("ble") ); ! Assert.IsFalse( sql.EndsWith("'") ); ! } ! ! [Test] ! public void EndsWithParameter() ! { ! SqlString sql = new SqlString( new object[] { "", "select", " from table where id = ", new Parameter() } ); ! Assert.IsFalse( sql.EndsWith("'") ); ! Assert.IsFalse( sql.EndsWith("") ); ! } ! ! [Test] ! public void StartsWith() ! { ! SqlString sql = new SqlString( new string[] {"select", " from table" } ); ! Assert.IsTrue( sql.StartsWith("s") ); ! Assert.IsFalse( sql.StartsWith(",") ); ! } ! ! [Test] ! public void StartsWithEmptyString() ! { ! SqlString sql = new SqlString( new string[] { "", "select", " from table" } ); ! Assert.IsTrue( sql.StartsWith("s") ); ! Assert.IsFalse( sql.StartsWith(",") ); ! } ! [Test] public void CompactWithNoParams() --- 33,37 ---- } ! [Test] public void CompactWithNoParams() *************** *** 123,126 **** --- 84,192 ---- [Test] + public void ContainsUntypedParameterWithoutParam() + { + SqlString sql = new SqlString( new string[] {"select", " from table"} ); + Assert.IsFalse( sql.ContainsUntypedParameter ); + } + + [Test] + public void ContainsUntypedParameterWithParam() + { + Parameter p1 = new Parameter(); + p1.SqlType = new SqlTypes.Int32SqlType(); + p1.Name = "p1"; + + SqlString sql = new SqlString( new object[] {"select", " from table where a = ", p1} ); + Assert.IsFalse( sql.ContainsUntypedParameter ); + } + + [Test] + public void ContainsUntypedParameterWithUntypedParam() + { + + SqlString sql = new SqlString( new object[] {"select", " from table where a = ", new Parameter()} ); + Assert.IsTrue( sql.ContainsUntypedParameter ); + } + + [Test] + public void ContainsUntypedParameterWithMixedUntypedParam() + { + Parameter p1 = new Parameter(); + p1.SqlType = new SqlTypes.Int32SqlType(); + p1.Name = "p1"; + + SqlString sql = new SqlString( new object[] {"select", " from table where a = ", new Parameter(), " and b = " , p1} ); + Assert.IsTrue( sql.ContainsUntypedParameter ); + } + + [Test] + public void EndsWith() + { + SqlString sql = new SqlString( new string[] {"select", " from table" } ); + Assert.IsTrue( sql.EndsWith("ble") ); + Assert.IsFalse( sql.EndsWith("'") ); + } + + [Test] + public void EndsWithEmptyString() + { + SqlString sql = new SqlString( new string[] { "", "select", " from table", "" } ); + Assert.IsTrue( sql.EndsWith("ble") ); + Assert.IsFalse( sql.EndsWith("'") ); + } + + [Test] + public void EndsWithParameter() + { + SqlString sql = new SqlString( new object[] { "", "select", " from table where id = ", new Parameter() } ); + Assert.IsFalse( sql.EndsWith("'") ); + Assert.IsFalse( sql.EndsWith("") ); + } + + [Test] + public void ParameterIndexesNoParams() + { + SqlString sql = new SqlString( new object[] {"select ", "from table ", "where 'a'='a'" } ); + + Assert.AreEqual( 0, sql.ParameterIndexes.Length ); + } + + [Test] + public void ParameterIndexOneParam() + { + SqlString sql = new SqlString( new object[] {"select ", "from table ", "where a = ", new Parameter() } ); + + Assert.AreEqual( 1, sql.ParameterIndexes.Length ); + Assert.AreEqual( 3, sql.ParameterIndexes[0] ); + } + + + [Test] + public void ParameterIndexManyParam() + { + SqlString sql = new SqlString( new object[] {"select ", "from table ", "where a = ", new Parameter(), " and c = ", new Parameter() } ); + + Assert.AreEqual( 2, sql.ParameterIndexes.Length ); + Assert.AreEqual( 3, sql.ParameterIndexes[0] ); + Assert.AreEqual( 5, sql.ParameterIndexes[1] ); + } + + [Test] + public void StartsWith() + { + SqlString sql = new SqlString( new string[] {"select", " from table" } ); + Assert.IsTrue( sql.StartsWith("s") ); + Assert.IsFalse( sql.StartsWith(",") ); + } + + [Test] + public void StartsWithEmptyString() + { + SqlString sql = new SqlString( new string[] { "", "select", " from table" } ); + Assert.IsTrue( sql.StartsWith("s") ); + Assert.IsFalse( sql.StartsWith(",") ); + } + + [Test] public void Substring() { |
From: Michael D. <mik...@us...> - 2004-08-20 15:26:34
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23509/NHibernate/SqlCommand Modified Files: SqlString.cs Log Message: Added methods to SqlString and tests for them. Index: SqlString.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand/SqlString.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SqlString.cs 18 Aug 2004 20:15:04 -0000 1.11 --- SqlString.cs 20 Aug 2004 15:26:24 -0000 1.12 *************** *** 1,3 **** --- 1,4 ---- using System; + using System.Collections; using System.Text; *************** *** 16,20 **** { readonly object[] sqlParts; ! public SqlString(string sqlPart) : this(new object[] {sqlPart}) { --- 17,22 ---- { readonly object[] sqlParts; ! private int[] parameterIndexes; ! public SqlString(string sqlPart) : this(new object[] {sqlPart}) { *************** *** 120,123 **** --- 122,150 ---- /// <summary> + /// Gets a bool that indicates if there is a Parameter that has a null SqlType. + /// </summary> + /// <value>true if there is a Parameter with a null SqlType.</value> + public bool ContainsUntypedParameter + { + get + { + for(int i=0; i<sqlParts.Length; i++) + { + Parameter paramPart = sqlParts[i] as Parameter; + if(paramPart!=null) + { + if( paramPart.SqlType==null ) + { + // only need to find one null SqlType + return true; + } + } + } + + return false; + } + } + + /// <summary> /// Determines whether the end of this instance matches the specified String. /// </summary> *************** *** 146,149 **** --- 173,205 ---- /// <summary> + /// Gets the indexes of the Parameters in the SqlParts + /// </summary> + /// <value> + /// An Int32 array that contains the indexes of the Parameters in the SqlPart array. + /// </value> + public int[] ParameterIndexes + { + get + { + // only calculate this one time because this object is immutable. + if( parameterIndexes==null ) + { + ArrayList paramList = new ArrayList(); + for(int i=0; i<sqlParts.Length; i++) + { + if(sqlParts[i] is Parameter) + { + paramList.Add(i); + } + } + + parameterIndexes = (int[])paramList.ToArray( typeof(int) ); + } + + return parameterIndexes ; + } + + } + /// <summary> /// Determines whether the beginning of this SqlString matches the specified System.String /// </summary> |
From: Michael D. <mik...@us...> - 2004-08-20 02:34:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9025 Modified Files: NHibernate-1.1.csproj Log Message: Applied patch provided by Kevin Williams to help with the building of DNCache and in jira as Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** NHibernate-1.1.csproj 16 Aug 2004 05:29:02 -0000 1.35 --- NHibernate-1.1.csproj 20 Aug 2004 02:34:20 -0000 1.36 *************** *** 336,339 **** --- 336,344 ---- /> <File + RelPath = "Cache\ICacheProvider.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Cache\NonstrictReadWriteCache.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-08-20 02:34:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9025/Cache Modified Files: HashtableCache.cs ICache.cs Added Files: ICacheProvider.cs Log Message: Applied patch provided by Kevin Williams to help with the building of DNCache and in jira as Index: HashtableCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/HashtableCache.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HashtableCache.cs 6 May 2004 20:53:59 -0000 1.1 --- HashtableCache.cs 20 Aug 2004 02:34:20 -0000 1.2 *************** *** 54,58 **** } ! #endregion } --- 54,70 ---- } ! public void Lock( object key ) ! { ! } ! ! public void Unlock( object key ) ! { ! } ! ! public long NextTimestamp() ! { ! return Timestamper.Next(); ! } ! #endregion } Index: ICache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ICache.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ICache.cs 6 May 2004 20:53:59 -0000 1.2 --- ICache.cs 20 Aug 2004 02:34:20 -0000 1.3 *************** *** 51,54 **** --- 51,60 ---- string Region {set;} + void Lock( object key ); + + void Unlock( object key ); + + long NextTimestamp(); + } --- NEW FILE: ICacheProvider.cs --- using System; using System.Collections; namespace NHibernate.Cache { /// <summary> /// Support for pluggable caches /// </summary> public interface ICacheProvider { /// <summary> /// Configure the cache /// </summary> /// <param name="regionName">the name of the cache region</param> /// <param name="properties">configuration settings</param> /// <returns></returns> ICache BuildCache(string regionName, ICollection properties ); /// <summary> /// generate a timestamp /// </summary> /// <returns></returns> long NextTimestamp(); } } |
From: Michael D. <mik...@us...> - 2004-08-20 02:00:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Tool/hbm2ddl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4678/NHibernate/Tool/hbm2ddl Modified Files: SchemaExport.cs Log Message: No longer using Transaction for the scope of creating the tables in the db. This will help the users of Firebird. Index: SchemaExport.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SchemaExport.cs 11 Jul 2004 21:00:10 -0000 1.10 --- SchemaExport.cs 20 Aug 2004 02:00:20 -0000 1.11 *************** *** 1,7 **** using System; ! using System.IO; using System.Data; using System.Text; ! using System.Collections; using NHibernate.Cfg; using NHibernate.Connection; --- 1,8 ---- using System; ! using System.Collections; using System.Data; + using System.IO; using System.Text; ! using NHibernate.Cfg; using NHibernate.Connection; *************** *** 13,20 **** { /// <summary> ! /// Commandline tool to export table schema for a configured <c>Configuration</c> to the database /// </summary> /// <remarks> ! /// To compile run "csc SchemaExport.cs /reference:../../bin/debug/NHibernate.dll" /// </remarks> public class SchemaExport --- 14,22 ---- { /// <summary> ! /// Generates ddl to export table schema for a configured <c>Configuration</c> to the database /// </summary> /// <remarks> ! /// This Class can be used directly or the command line wrapper NHibernate.Tool.hbm2ddl.exe can be ! /// used when a dll can not be directly used. /// </remarks> public class SchemaExport *************** *** 30,33 **** --- 32,36 ---- /// Create a schema exported for a given Configuration /// </summary> + /// <param name="cfg">The NHibernate Configuration to generate the schema from.</param> public SchemaExport(Configuration cfg) : this(cfg, cfg.Properties) { *************** *** 38,43 **** /// database connection properties /// </summary> ! /// <param name="cfg"></param> ! /// <param name="connectionProperties"></param> public SchemaExport(Configuration cfg, IDictionary connectionProperties) { --- 41,46 ---- /// database connection properties /// </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 connectionProperties) { *************** *** 51,54 **** --- 54,59 ---- /// Set the output filename. The generated script will be written to this file /// </summary> + /// <param name="filename">The name of the file to output the ddl to.</param> + /// <returns>The SchemaExport object.</returns> public SchemaExport SetOutputFile(string filename) { *************** *** 60,63 **** --- 65,70 ---- /// Set the end of statement delimiter /// </summary> + /// <param name="delimiter">The end of statement delimiter.</param> + /// <returns>The SchemaExport object.</returns> public SchemaExport SetDelimiter(string delimiter) { *************** *** 68,71 **** --- 75,84 ---- /// Run the schema creation script /// </summary> + /// <param name="script"><c>true</c> if the ddl should be outputted in the Console.</param> + /// <param name="export"><c>true</c> if the ddl should be executed against the Database.</param> + /// <remarks> + /// This is a convenience method that calls <see cref="Execute(bool, bool, bool, bool)"/> and sets + /// the justDrop parameter to false and the format parameter to true. + /// </remarks> public void Create(bool script, bool export) { *************** *** 76,79 **** --- 89,98 ---- /// Run the drop schema script /// </summary> + /// <param name="script"><c>true</c> if the ddl should be outputted in the Console.</param> + /// <param name="export"><c>true</c> if the ddl should be executed against the Database.</param> + /// <remarks> + /// This is a convenience method that calls <see cref="Execute(bool, bool, bool, bool)"/> and sets + /// the justDrop and format parameter to true. + /// </remarks> public void Drop(bool script, bool export) { *************** *** 81,88 **** } ! private void Execute(bool script, bool export, bool justDrop, bool format) { IDbConnection connection = null; - IDbTransaction transaction = null; StreamWriter fileOutput = null; IConnectionProvider connectionProvider = null; --- 100,116 ---- } ! /// <summary> ! /// Executes the Export of the Schema. ! /// </summary> ! /// <param name="script"><c>true</c> if the ddl should be outputted in the Console.</param> ! /// <param name="export"><c>true</c> if the ddl should be executed against the Database.</param> ! /// <param name="justDrop"><c>true</c> if only the ddl to drop the Database objects should be executed.</param> ! /// <param name="format"><c>true</c> if the ddl should be nicely formatted instead of one statement per line.</param> ! /// <remarks> ! /// This method allows for both the drop and create ddl script to be executed. ! /// </remarks> ! public void Execute(bool script, bool export, bool justDrop, bool format) { IDbConnection connection = null; StreamWriter fileOutput = null; IConnectionProvider connectionProvider = null; *************** *** 114,118 **** connectionProvider = ConnectionProviderFactory.NewConnectionProvider(props); connection = connectionProvider.GetConnection(); - transaction = connection.BeginTransaction(); statement = connection.CreateCommand(); } --- 142,145 ---- *************** *** 122,126 **** try { ! string formatted = dropSQL[i]; if (delimiter!=null) formatted += delimiter; if (script) Console.WriteLine(formatted); --- 149,162 ---- try { ! string formatted; ! if(format) ! { ! formatted = Format( dropSQL[i] ); ! } ! else ! { ! formatted = dropSQL[i]; ! } ! if (delimiter!=null) formatted += delimiter; if (script) Console.WriteLine(formatted); *************** *** 130,134 **** statement.CommandText = dropSQL[i]; statement.CommandType = CommandType.Text; - statement.Transaction = transaction; statement.ExecuteNonQuery(); } --- 166,169 ---- *************** *** 147,151 **** try { ! string formatted = createSQL[j]; if (delimiter!=null) formatted += delimiter; if (script) Console.WriteLine(formatted); --- 182,194 ---- try { ! string formatted; ! if(format) ! { ! formatted = Format( createSQL[j] ); ! } ! else ! { ! formatted = createSQL[j]; ! } if (delimiter!=null) formatted += delimiter; if (script) Console.WriteLine(formatted); *************** *** 155,159 **** statement.CommandText = createSQL[j]; statement.CommandType = CommandType.Text; - statement.Transaction = transaction; statement.ExecuteNonQuery(); } --- 198,201 ---- *************** *** 166,185 **** } } - - // if the parameter export==false then there will be no transaction - // to commit. - if (transaction!=null) transaction.Commit(); } catch (Exception e) { - if (transaction != null) - { - try - { - transaction.Rollback(); - } - catch {} - } Console.Write(e.StackTrace); throw new HibernateException( e.Message ); --- 208,215 ---- *************** *** 215,227 **** /// <summary> ! /// Format an SQL statement using simple rules: ! /// a) Insert newline after each comma; ! /// b) Indent three spaces after each inserted newline; ! /// If the statement contains single/double quotes return unchanged, ! /// it is too complex and could be broken by simple formatting. /// </summary> ! private static string Format(string sql) { ! ! if ( sql.IndexOf("\"") > 0 || sql.IndexOf("'") > 0) { return sql; } --- 245,273 ---- /// <summary> ! /// Format an SQL statement using simple rules /// </summary> ! /// <param name="sql">The string containing the sql to format.</param> ! /// <returns>A string that contains formatted sql.</returns> ! /// <remarks> ! /// The simple rules to used when formatting are: ! /// <list type="number"> ! /// <item> ! /// <description>Insert a newline after each comma</description> ! /// </item> ! /// <item> ! /// <description>Indent three spaces after each inserted newline</description> ! /// </item> ! /// <item> ! /// <description> ! /// If the statement contains single/double quotes return unchanged because ! /// it is too complex and could be broken by simple formatting. ! /// </description> ! /// </item> ! /// </list> ! /// </remarks> ! private static string Format(string sql) ! { ! if ( sql.IndexOf("\"") > 0 || sql.IndexOf("'") > 0) ! { return sql; } *************** *** 229,234 **** string formatted; ! if ( sql.ToLower().StartsWith("create table") ) { ! StringBuilder result = new StringBuilder(60); StringTokenizer tokens = new StringTokenizer( sql, "(,)", true); --- 275,280 ---- string formatted; ! if ( sql.ToLower().StartsWith("create table") ) ! { StringBuilder result = new StringBuilder(60); StringTokenizer tokens = new StringTokenizer( sql, "(,)", true); *************** *** 236,241 **** int depth = 0; ! foreach(string tok in tokens) { ! if ( StringHelper.ClosedParen.Equals(tok) ) { depth--; if (depth==0) result.Append("\n"); --- 282,289 ---- int depth = 0; ! foreach(string tok in tokens) ! { ! if ( StringHelper.ClosedParen.Equals(tok) ) ! { depth--; if (depth==0) result.Append("\n"); *************** *** 243,247 **** result.Append(tok); if ( StringHelper.Comma.Equals(tok) && depth==1 ) result.Append("\n "); ! if ( StringHelper.OpenParen.Equals(tok) ) { depth++; if ( depth==1 ) result.Append("\n "); --- 291,296 ---- result.Append(tok); if ( StringHelper.Comma.Equals(tok) && depth==1 ) result.Append("\n "); ! if ( StringHelper.OpenParen.Equals(tok) ) ! { depth++; if ( depth==1 ) result.Append("\n "); *************** *** 250,312 **** formatted = result.ToString(); ! } else { formatted = sql; } return formatted; ! } ! ! public static void Main(string[] args) { ! try { ! Configuration cfg = new Configuration(); ! ! bool script = true; ! bool drop = false; ! bool export = true; ! string outputFile = null; ! string propFile = null; ! bool formatSQL = false; ! string delimiter = null; ! ! for ( int i=0; i<args.Length; i++ ) { ! if ( args[i].StartsWith("--") ) { ! if ( args[i].Equals("--quiet") ) { ! script = false; ! } else if ( args[i].Equals("--drop") ) { ! drop = true; ! } else if ( args[i].Equals("--text") ) { ! export = false; ! } else if ( args[i].Equals("--output=") ) { ! outputFile = args[i].Substring(13); ! } else if ( args[i].Equals("--format") ) { ! formatSQL = true; ! } else if ( args[i].Equals("--delimiter=") ) { ! delimiter = args[i].Substring(12); ! } else if ( args[i].Equals("--config=") ) { ! cfg.Configure( args[i].Substring(9) ); ! } ! } else { ! string filename = args[i]; ! if ( filename.EndsWith( ".dll") || filename.EndsWith( ".exe") ) { ! cfg.AddAssembly( filename ); ! } else { ! cfg.AddXmlFile(filename); ! } ! } ! } ! if (propFile!=null) { ! //TODO: load up a props file (xml based probably..) ! } else { ! new SchemaExport(cfg) ! .SetOutputFile(outputFile) ! .SetDelimiter(delimiter) ! .Execute(script, export, drop, formatSQL); ! } ! } catch(Exception e) { ! Console.Error.WriteLine("Error creating schema " + e.Message ); ! Console.Error.Write(e.StackTrace); ! } ! } ! } } --- 299,310 ---- formatted = result.ToString(); ! } ! else ! { formatted = sql; } return formatted; ! } } } |
From: Michael D. <mik...@us...> - 2004-08-19 18:38:10
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28882/NHibernate.Test Modified Files: FooBarTest.cs Log Message: completed another test because Filter is working better. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** FooBarTest.cs 16 Aug 2004 05:15:10 -0000 1.58 --- FooBarTest.cs 19 Aug 2004 18:38:00 -0000 1.59 *************** *** 645,649 **** [Test] - [Ignore("ISession.Filter is not working. http://jira.nhibernate.org:8080/browse/NH-80")] public void CollectionWhere() { --- 645,648 ---- *************** *** 668,673 **** Assert.AreEqual( 1, s.Find("from Baz baz, baz.FooArray foo").Count ); Assert.AreEqual( 2, s.Find("from Foo foo").Count ); ! // TODO: filter is not working because QueryKeyCacheFactor is null ! //Assert.AreEqual( 1, s.Filter(baz.FooArray, "").Count ); s.Delete("from Foo foo"); --- 667,671 ---- Assert.AreEqual( 1, s.Find("from Baz baz, baz.FooArray foo").Count ); Assert.AreEqual( 2, s.Find("from Foo foo").Count ); ! Assert.AreEqual( 1, s.Filter(baz.FooArray, "").Count ); s.Delete("from Foo foo"); |
From: Michael D. <mik...@us...> - 2004-08-19 17:54:04
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21097/NHibernate/Util Modified Files: StringHelper.cs Log Message: removed [Obsolete] Join method. Index: StringHelper.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Util/StringHelper.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** StringHelper.cs 12 Jul 2004 01:30:21 -0000 1.14 --- StringHelper.cs 19 Aug 2004 17:53:55 -0000 1.15 *************** *** 15,23 **** public const string SqlParameter = "?"; - [Obsolete("Use String.Join() instead of this method. It does the same thing")] - public static string Join(string separator, string[] strings) { - return string.Join(separator, strings); - } - public static string Repeat(string str, int times) { StringBuilder buf = new StringBuilder(str.Length * times); --- 15,18 ---- |
From: Michael D. <mik...@us...> - 2004-08-19 17:52:55
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20945/NHibernate/Sql Modified Files: QuerySelect.cs Log Message: removed code to build sql in a string - it now uses a SqlStringBuilder instead of a StringBuilder. Index: QuerySelect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/QuerySelect.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** QuerySelect.cs 18 Aug 2004 20:47:52 -0000 1.8 --- QuerySelect.cs 19 Aug 2004 17:52:43 -0000 1.9 *************** *** 14,24 **** { private SqlCommand.JoinFragment joins; ! private StringBuilder select = new StringBuilder(); ! private StringBuilder where = new StringBuilder(); private SqlCommand.SqlStringBuilder whereBuilder = new SqlCommand.SqlStringBuilder(); private StringBuilder groupBy = new StringBuilder(); private StringBuilder orderBy = new StringBuilder(); private StringBuilder having = new StringBuilder(); ! private bool distinct=false; private static readonly IList dontSpace = new ArrayList(); --- 14,28 ---- { private SqlCommand.JoinFragment joins; ! ! // the selectBuilder could probably be a string if the Persister's methods that build ! // the SqlString instead returned a String. ! private SqlCommand.SqlStringBuilder selectBuilder = new SqlCommand.SqlStringBuilder(); private SqlCommand.SqlStringBuilder whereBuilder = new SqlCommand.SqlStringBuilder(); + + // groupBy, orderBy, and having will for sure have no parameters. private StringBuilder groupBy = new StringBuilder(); private StringBuilder orderBy = new StringBuilder(); private StringBuilder having = new StringBuilder(); ! private bool distinct = false; private static readonly IList dontSpace = new ArrayList(); *************** *** 65,77 **** public void AddSelectFragmentString(string fragment) { ! if ( fragment.Length>0 && fragment[0]==',' ) fragment = fragment.Substring(1); fragment = fragment.Trim(); ! if ( fragment.Length>0 ) { ! if ( select.Length>0 ) select.Append(StringHelper.CommaSpace); ! select.Append(fragment); } } ! public void AddSelectColumn(string columnName, string alias) { --- 69,95 ---- public void AddSelectFragmentString(string fragment) { ! AddSelectFragmentString( new SqlCommand.SqlString(fragment) ); ! } ! ! public void AddSelectFragmentString(SqlCommand.SqlString fragment) ! { ! if( fragment.SqlParts.Length>0 && fragment.StartsWith(",") ) ! { ! fragment = fragment.Substring(1); ! } ! fragment = fragment.Trim(); ! ! if( fragment.SqlParts.Length > 0 ) { ! if( selectBuilder.Count > 0 ) ! { ! selectBuilder.Add(StringHelper.CommaSpace); ! } ! ! selectBuilder.Add(fragment); } } ! public void AddSelectColumn(string columnName, string alias) { *************** *** 115,161 **** } - [Obsolete("Should be using ToQuerySqlString instead")] - public string ToQueryString() - { - StringBuilder buf = new StringBuilder(50) - .Append("select "); - - if (distinct) buf.Append("distinct "); - - //TODO: HACK with ToString() - string from = joins.ToFromFragmentString.ToString(); - 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 ); - - //TODO: HACK with ToString() - string part1 = joins.ToWhereFragmentString.ToString().Trim(); - string part2 = where.ToString().Trim(); - bool hasPart1 = part1.Length > 0; - bool hasPart2 = part2.Length > 0; - - if (hasPart1 || hasPart2) buf.Append(" where "); - if (hasPart1) buf.Append( part1.Substring(4) ); - if (hasPart2) - { - if (hasPart1) buf.Append(" and ("); - buf.Append(part2); - if (hasPart1) buf.Append(")"); - } - if ( groupBy.Length > 0 ) buf.Append(" group by ").Append( groupBy.ToString() ); - if ( having.Length > 0 ) buf.Append(" having ").Append( having.ToString() ); - if ( orderBy.Length > 0 ) buf.Append(" order by ").Append( orderBy.ToString() ); - return buf.ToString(); - } - public SqlCommand.SqlString ToQuerySqlString() { --- 133,136 ---- *************** *** 176,180 **** } ! builder.Add(select.ToString()) .Add(" from") .Add( from ); --- 151,155 ---- } ! builder.Add(selectBuilder.ToSqlString()) .Add(" from") .Add( from ); |
From: Michael D. <mik...@us...> - 2004-08-19 17:51:12
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20741/NHibernate/Persister Modified Files: NormalizedEntityPersister.cs Log Message: removed code that was commented out. Index: NormalizedEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/NormalizedEntityPersister.cs,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** NormalizedEntityPersister.cs 16 Aug 2004 05:30:59 -0000 1.25 --- NormalizedEntityPersister.cs 19 Aug 2004 17:51:03 -0000 1.26 *************** *** 139,144 **** protected IUniqueEntityLoader loader; protected readonly IDictionary lockers = new Hashtable(); - - // private readonly bool[] allProperties; private static readonly string[] StringArray = {}; --- 139,142 ---- |
From: Michael D. <mik...@us...> - 2004-08-19 17:50:09
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20390/NHibernate/Loader Modified Files: AbstractEntityLoader.cs Loader.cs OneToManyLoader.cs Log Message: removed [Obsolete] SQLString (not SqlString) property. Index: AbstractEntityLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/AbstractEntityLoader.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AbstractEntityLoader.cs 16 Aug 2004 05:26:39 -0000 1.8 --- AbstractEntityLoader.cs 19 Aug 2004 17:49:59 -0000 1.9 *************** *** 49,58 **** ) .SetOuterJoins ! ( ! //TODO: ToWhereFragmentString.ToString() is a HACK - removed ! ojf.ToFromFragmentString, ojf.ToWhereFragmentString.Append( - //TODO: HACK with ToString() - removed UseQueryWhereFragment ? ( (IQueryable) persister).QueryWhereFragment(alias, true, true) : --- 49,55 ---- ) .SetOuterJoins ! ( ojf.ToFromFragmentString, ojf.ToWhereFragmentString.Append( UseQueryWhereFragment ? ( (IQueryable) persister).QueryWhereFragment(alias, true, true) : *************** *** 99,103 **** sqlBuilder.AddWhereClause(condition); - //TODO: HACK with ToString() sqlBuilder.SetOuterJoins( ojf.ToFromFragmentString, --- 96,99 ---- Index: Loader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/Loader.cs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Loader.cs 18 Aug 2004 20:47:51 -0000 1.27 --- Loader.cs 19 Aug 2004 17:49:59 -0000 1.28 *************** *** 33,49 **** /// <summary> ! /// The SQL query string to be called; implemented by all subclasses ! /// </summary> ! /// <remarks> ! /// TODO: This should be removed when the Implementation has gone completely SqlString() based. ! /// The only peice holding this up is the QueryTranslator. ! /// </remarks> ! [Obsolete("Should use SqlString instead of a string to hold the SQL")] ! public virtual string SQLString { ! get { throw new NotImplementedException("This will be depreciated - don't use."); } ! } ! ! /// <summary> ! /// The SqlString to be called; implemented by alll subclasses /// </summary> public abstract SqlString SqlString {get;} --- 33,37 ---- /// <summary> ! /// The SqlString to be called; implemented by all subclasses /// </summary> public abstract SqlString SqlString {get;} Index: OneToManyLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/OneToManyLoader.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OneToManyLoader.cs 16 Aug 2004 05:26:39 -0000 1.8 --- OneToManyLoader.cs 19 Aug 2004 17:49:59 -0000 1.9 *************** *** 72,76 **** if(collectionPersister.HasWhere) selectBuilder.AddWhereClause(whereSqlString); - //TODO: ToWhereFragmentString.ToString() is a HACK - removed selectBuilder.SetOuterJoins( ojf.ToFromFragmentString, --- 72,75 ---- |
From: Michael D. <mik...@us...> - 2004-08-19 17:48:44
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20239/NHibernate/Impl Modified Files: SessionFactoryImpl.cs SessionImpl.cs Log Message: removed AdoHack and all use of it - no longer needed. Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** SessionImpl.cs 9 Aug 2004 18:28:04 -0000 1.38 --- SessionImpl.cs 19 Aug 2004 17:48:35 -0000 1.39 *************** *** 20,188 **** { - #warning Hack transaction and parameters - // Put all hacks to get SimpleTest to work into this class so we can trace it - // used by: - public class AdoHack { - - //TODO: DEISGNISSUE: come up with a good way to create named parameters instead of ? - // because IDbCommand has to use @Name and can't use ? - - // Force parametercollection to be created - // Of course this is not the right place, this really means the entire concept - // of named parameters should be revised!!! - public static void CreateParameters(Dialect.Dialect dialect, IDbCommand cmd) - { - string sql = cmd.CommandText; - - if (sql == null) - return; - //TODO: once this HACK class is removed get rid of the UseNamedParameters - // and the NamedParametersPrefix Properties in Dialect and all subclasses. - if (dialect.UseNamedParameters) - { - /* - * (?<param>\?) - * Capture to <param> - * ? - * - * "select a,b,c from a=? and b=? and c=?" - * Splitting: select a,b,c from a=? and b=? and c=? - * [0] => select a,b,c from a= - * [1] => ? - * [2] => and b= - * [3] => ? - * [4] => and c= - * [5] => ? - * [6] => - * (?<param>@\w*\b) -> actual string for Ms Sql 2000 Dialect (@=named param prefix - * Capture to <param> - * : - * Any word character - * * (zero or more times) - * Word boundy between //w and //W - * - * takes a string like "select a,b,c from a=@p1 and b=@p2 c='@'" - * and splits it into - * Splitting: select a,b,c from a=@p1 and b=@p2 and c='@' - * [0] => select a,b,c from a= - * [1] => @p1 - * [2] => and b= - * [3] => @p2 - * [4] => and c='@' - */ - Regex parser = new Regex("(?<param>" + dialect.NamedParametersPrefix + "\\w*\\b)", RegexOptions.None); //.Compiled); - string[] tokens = parser.Split(sql); - if (tokens.Length > 0) - { - for (int idx=0; idx < tokens.Length; idx++) - { - string token = tokens[idx]; - - if (token != null && token.Length > 1 && token.Substring(0, 1).Equals(dialect.NamedParametersPrefix)) - { - IDbDataParameter param; - - param = cmd.CreateParameter(); - param.ParameterName = token; - cmd.Parameters.Add(param); - } - } - } - } - else - { - int idx = 0; - int paramIdx = 0; - - while((idx=sql.IndexOf("?", idx)) != -1) - { - IDbDataParameter param; - - param = cmd.CreateParameter(); - param.ParameterName = dialect.UseNamedParameters ? dialect.NamedParametersPrefix + "p" + paramIdx.ToString() : paramIdx.ToString(); - cmd.Parameters.Add(param); - paramIdx++; - idx++; - } - } - } - - public static void ReplaceHqlParameters(Dialect.Dialect dialect, IDbCommand cmd) - { - /* - * (?<param>\[<\w*>\]) - * Capture to <param> - * [< - * Any word character - * *(zero or more times) - * >] - * - * select a,b,c from a=[<parama>] and b=[<paramb>] - * for the life of me I could not figure out why the params would be wrapped - * with a "[<" and ">]" - turns out in Hql.WhereParser.DoTokens one of the original - * developers changed it to that from "?" -> that is what I would prefer to use - * instead of this silly parameter and regexp use... - * - * Splitting: select a,b,c from a=[<parama>] and b=[<paramb>] - * [0] => select a,b,c from a= - * [1] => [<parama>] - * [2] => and b= - * [3] => [<paramb>] - * [4] => - * - */ - Regex parser = new Regex("(?<param>\\[<\\w*>\\])", RegexOptions.Compiled); - string[] tokens; - string sql = cmd.CommandText; - - if (sql == null) - return; - tokens = parser.Split(sql); - if (tokens.Length > 0) - { - StringBuilder sb = new StringBuilder(); - - for (int idx=0; idx < tokens.Length; idx++) - { - string token = tokens[idx]; - - if (token != null && token.Length > 1 && token.Substring(0, 2).Equals("[<")) - { - if (dialect.UseNamedParameters) - { - IDbDataParameter param; - - param = cmd.CreateParameter(); - param.ParameterName = dialect.NamedParametersPrefix + token.Substring(2, token.Length - 4); - cmd.Parameters.Add(param); - sb.Append(param.ParameterName); - } - else - { - throw new NotImplementedException("Hack not complete for this dialect"); - } - } - else - { - sb.Append(token); - } - } - cmd.CommandText = sb.ToString(); - } - } - - // parametercollection starts at 0 - public static int ParameterPos(int pos) - { - return pos - 1; - } - - } - // -- end of Hack - - - - - /// <summary> /// Concrete implementation of a Session, also the central, organizing component of --- 20,23 ---- Index: SessionFactoryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** SessionFactoryImpl.cs 16 Aug 2004 05:09:30 -0000 1.26 --- SessionFactoryImpl.cs 19 Aug 2004 17:48:35 -0000 1.27 *************** *** 565,572 **** retVal.CommandType = CommandType.Text; ! // Hack: force parameters to be created ! Impl.AdoHack.CreateParameters(dialect, retVal); ! // end-of Hack ! // Hack: disable Prepare() as long as the parameters have no datatypes!! #if FALSE --- 565,569 ---- retVal.CommandType = CommandType.Text; ! // Hack: disable Prepare() as long as the parameters have no datatypes!! #if FALSE |
From: Michael D. <mik...@us...> - 2004-08-19 17:46:49
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19972/NHibernate/Hql Modified Files: PathExpressionParser.cs QueryTranslator.cs WhereParser.cs Log Message: cleaned up code not needed because of migration to SqlString. Index: WhereParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/WhereParser.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** WhereParser.cs 18 Aug 2004 20:47:51 -0000 1.18 --- WhereParser.cs 19 Aug 2004 17:46:38 -0000 1.19 *************** *** 34,56 **** //TODO: HACK to make this internal for QueryTranslator... private static StringCollection booleanOperators = new StringCollection(); //tokens that would indicate a sub expression is a boolean expression ! private static string booleanOperatorsAsRegEx = string.Empty; ! internal static string BooleanOperatorsAsRegEx ! { ! get ! { ! if (booleanOperatorsAsRegEx.Length != 0) ! return booleanOperatorsAsRegEx; ! StringBuilder sb = new StringBuilder(@"(?:\(|"); ! foreach(string s in booleanOperators) ! { ! sb.Append(s); ! sb.Append("|"); ! } ! sb.Remove(sb.Length-1, 1); ! sb.Append(@")[^\w]*$"); ! booleanOperatorsAsRegEx = sb.ToString(); ! return booleanOperatorsAsRegEx; ! } ! } private static IDictionary negations = new Hashtable(); private Dialect.Dialect d; --- 34,38 ---- //TODO: HACK to make this internal for QueryTranslator... private static StringCollection booleanOperators = new StringCollection(); //tokens that would indicate a sub expression is a boolean expression ! private static IDictionary negations = new Hashtable(); private Dialect.Dialect d; *************** *** 451,455 **** { SqlCommand.JoinFragment fromClause = q.CreateJoinFragment(true); - //TODO: HACK with StringEmpty and SqlString fromClause.AddJoins( ojf.ToFromFragmentString, new SqlCommand.SqlString(String.Empty) ); q.AddJoin( pathExpressionParser.Name, fromClause ); --- 433,436 ---- *************** *** 467,478 **** { q.AddNamedParameter(token.Substring(1)); - // AppendToken(q, StringHelper.SqlParameter); AppendToken(q, new SqlCommand.SqlString( new object[] { new SqlCommand.Parameter() } ) ); } else if ( token.Equals(StringHelper.SqlParameter) ) { ! //TODO: this is all new code - I'm just looking for a way to find out when ! // we are adding a parameter ! // q.AppendWhereToken(token); q.AppendWhereToken(new SqlCommand.SqlString( new object[] { new SqlCommand.Parameter() } ) ); } --- 448,457 ---- { q.AddNamedParameter(token.Substring(1)); AppendToken(q, new SqlCommand.SqlString( new object[] { new SqlCommand.Parameter() } ) ); } else if ( token.Equals(StringHelper.SqlParameter) ) { ! //if the token is a "?" then we have a Parameter so convert it to a SqlCommand.Parameter ! // instead of appending a "?" to the WhereTokens q.AppendWhereToken(new SqlCommand.SqlString( new object[] { new SqlCommand.Parameter() } ) ); } Index: QueryTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/QueryTranslator.cs,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** QueryTranslator.cs 18 Aug 2004 20:47:51 -0000 1.38 --- QueryTranslator.cs 19 Aug 2004 17:46:38 -0000 1.39 *************** *** 71,76 **** private bool distinct = false; protected bool compiled; ! private string sqlString; ! private SqlCommand.SqlString realSqlString; private System.Type holderClass; private ConstructorInfo holderConstructor; --- 71,75 ---- private bool distinct = false; protected bool compiled; ! private SqlCommand.SqlString sqlString; private System.Type holderClass; private ConstructorInfo holderConstructor; *************** *** 256,276 **** } - [Obsolete("Should use Hql.QueryTranslator.SqlString property instead")] - public override string SQLString - { - get - { - LogQuery(queryString, sqlString); - return sqlString; - } - } - - public override SqlString SqlString { get { ! LogQuery( queryString, realSqlString.ToString() ); ! return realSqlString; } } --- 255,264 ---- } public override SqlString SqlString { get { ! LogQuery( queryString, sqlString.ToString() ); ! return sqlString; } } *************** *** 459,466 **** else { - //TODO: HACKS with ToString() - fixed up oldjoin.AddCondition( newjoin.ToWhereFragmentString ); //TODO: HACKS with ToString() ! if ( oldjoin.ToFromFragmentString.ToString().IndexOf( newjoin.ToFromFragmentString.ToString().Trim()) < 0 ) { throw new AssertionFailure("bug in query parser: " + queryString); --- 447,453 ---- else { oldjoin.AddCondition( newjoin.ToWhereFragmentString ); //TODO: HACKS with ToString() ! if ( oldjoin.ToFromFragmentString.ToString().IndexOf( newjoin.ToFromFragmentString.Trim().ToString() ) < 0 ) { throw new AssertionFailure("bug in query parser: " + queryString); *************** *** 621,626 **** } ! // sqlString = sql.ToQueryString(); ! realSqlString = sql.ToQuerySqlString(); --- 608,612 ---- } ! sqlString = sql.ToQuerySqlString(); *************** *** 651,656 **** string name = (string) returnTypes[k]; string suffix = size==1 ? String.Empty : k.ToString() + StringHelper.Underscore; ! //TODO: HACK with ToString() ! sql.AddSelectFragmentString( persisters[k].IdentifierSelectFragment(name, suffix).ToString() ); } } --- 637,641 ---- string name = (string) returnTypes[k]; string suffix = size==1 ? String.Empty : k.ToString() + StringHelper.Underscore; ! sql.AddSelectFragmentString( persisters[k].IdentifierSelectFragment(name, suffix) ); } } *************** *** 680,685 **** string suffix = (size==1) ? String.Empty : k.ToString() + StringHelper.Underscore; string name = (string) returnTypes[k]; ! //TODO: HACK with ToString() ! sql.AddSelectFragmentString( persisters[k].PropertySelectFragment(name, suffix).ToString() ); } } --- 665,669 ---- string suffix = (size==1) ? String.Empty : k.ToString() + StringHelper.Underscore; string name = (string) returnTypes[k]; ! sql.AddSelectFragmentString( persisters[k].PropertySelectFragment(name, suffix) ); } } *************** *** 942,954 **** IDictionary namedParams, IDictionary lockModes, ISessionImplementor session) { - //TODO: this is a major hack - apply locks is not working with a string of Sql so we need - // to give it a SqlString... - //http://jira.nhibernate.org:8080/browse/NH-64 - // ApplyLocks(SqlString, lockModes, session.Factory.Dialect).ToString(), - // this works because it is just appending strings and not doing any - // string sqlWithLock = ApplyLocks(new SqlString(SQLString), lockModes, session.Factory.Dialect).ToString(); SqlString sqlWithLock = ApplyLocks(SqlString, lockModes, session.Factory.Dialect); - IDbCommand st = PrepareQueryStatement( sqlWithLock, --- 926,931 ---- *************** *** 1106,1111 **** IDictionary lockModes) { - - // TODO: fix the last parameter that is suppoesd to use lockModes return base.Find(session, values, types, returnProxies, selection, namedParams, lockModes); } --- 1083,1086 ---- *************** *** 1357,1375 **** } ! ! // StringTokenizer tokenizer = new StringTokenizer(sql, StringHelper.SqlParameter, true); ! // string[] tokens = sql.Split(StringHelper.SqlParameter[0]); ! // ! // SqlStringBuilder hqlToSqlBuilder = new SqlStringBuilder(types.Length * 2); ! SqlStringBuilder hqlBuilder = new SqlStringBuilder(sql); //this.SqlString ! // IEnumerator tokenEnum = tokenizer.GetEnumerator(); ! // string previousToken = String.Empty; ! // string token = String.Empty; int paramIndex = 0; ! // ! // while(tokenEnum.MoveNext()) for( int i=0; i<hqlBuilder.Count; i++ ) { - // token = (string)tokenEnum.Current; Parameter partParam = hqlBuilder[i] as Parameter; if(partParam!=null) --- 1332,1341 ---- } ! ! SqlStringBuilder hqlBuilder = new SqlStringBuilder(sql); int paramIndex = 0; ! for( int i=0; i<hqlBuilder.Count; i++ ) { Parameter partParam = hqlBuilder[i] as Parameter; if(partParam!=null) *************** *** 1379,1412 **** paramIndex++; } - // if(token.Equals(StringHelper.SqlParameter) - // && ( EndsWithBoolOperator( previousToken ) ) ) //.EndsWith("=") || previousToken.EndsWith("= ") ) ) - // { - // Parameter param = Parameter.GenerateParameters(session.Factory, new string[]{paramIndex.ToString()}, paramTypes[paramIndex])[0]; - // hqlToSqlBuilder.Add(param); - // paramIndex++; - // } - // else - // { - // hqlToSqlBuilder.Add(token); - // } - // - // previousToken = token; } - // return PrepareCommand(hqlToSqlBuilder.ToSqlString(), paramValues, paramTypes, null, selection, scroll, session); return PrepareCommand(hqlBuilder.ToSqlString(), paramValues, paramTypes, null, selection, scroll, session); } - - /// <summary> - /// Temp method to help us figure out if the string ends with character that indicate that - /// a parameter is likely to follow. - /// </summary> - /// <param name="sqlFragment">A string that contains sql.</param> - /// <returns>true when a Parameter might follow this sql.</returns> - private bool EndsWithBoolOperator(string sqlFragment) - { - Regex r = new Regex(WhereParser.BooleanOperatorsAsRegEx, RegexOptions.IgnoreCase | RegexOptions.Compiled); - return r.Match(sqlFragment).Success; - } } } \ No newline at end of file --- 1345,1352 ---- Index: PathExpressionParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/PathExpressionParser.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PathExpressionParser.cs 18 Aug 2004 20:47:51 -0000 1.15 --- PathExpressionParser.cs 19 Aug 2004 17:46:38 -0000 1.16 *************** *** 115,119 **** { JoinFragment ojf = q.GetPathJoin(path); - //TODO: HACK with ToString() join.AddCondition( ojf.ToWhereFragmentString); //after reset! // we don't need to worry about any condition in the ON clause --- 115,118 ---- *************** *** 350,354 **** { IQueryable persister = q.GetPersister( ( (EntityType) memberPersister.ElementType ).PersistentClass ); - //TODO: HACK with ToString() - cleaned up ojf.AddJoins( persister.FromJoinFragment(collectionName, true, false), --- 349,352 ---- *************** *** 483,490 **** .Append(' ') .Append(collectionName)*/ ! //TODO: HACK with ToString() ! .Append(join.ToFromFragmentString.ToString().Substring(2)) //remove initial ", " .Append(" WHERE ") ! .Append(join.ToWhereFragmentString.ToString().Substring(5)) //TODO: HACK with ToString() .ToString(); } --- 481,487 ---- .Append(' ') .Append(collectionName)*/ ! .Append(join.ToFromFragmentString.Substring(2)) //remove initial ", " .Append(" WHERE ") ! .Append(join.ToWhereFragmentString.Substring(5)) .ToString(); } |
From: Michael D. <mik...@us...> - 2004-08-19 17:45:35
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19739/NHibernate/Dialect Modified Files: Dialect.cs MsSql2000Dialect.cs Oracle9Dialect.cs SybaseDialect.cs Log Message: Removed [Obsolete] properties. Index: Oracle9Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/Oracle9Dialect.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Oracle9Dialect.cs 19 Jul 2004 16:05:50 -0000 1.11 --- Oracle9Dialect.cs 19 Aug 2004 17:45:25 -0000 1.12 *************** *** 179,195 **** } - [Obsolete("See the Dialect class for reason")] - public override bool UseNamedParameters - { - get { return true; } - } - - [Obsolete("See the Dialect class for reason")] - public override string NamedParametersPrefix - { - get { return ":"; } - } - - public class SysdateQueryFunctionInfo : IQueryFunctionInfo { --- 179,182 ---- Index: Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/Dialect.cs,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Dialect.cs 16 Aug 2004 05:30:58 -0000 1.36 --- Dialect.cs 19 Aug 2004 17:45:24 -0000 1.37 *************** *** 501,534 **** get { return aggregateFunctions;} } - - /// <summary> - /// Does this dialect use named parameters? - /// </summary> - /// <remarks> - /// Do NOT use this Property. It will be removed once the class ADOHack has been removed. Instead - /// the Driver should be used because that is what determines how the CommandText and Parameters - /// have to be built. - /// </remarks> - [Obsolete("This method will be removed once the class ADOHack is gone. The Driver should be used instead.")] - public virtual bool UseNamedParameters - { - get { return false; } - } - - /// <summary> - /// The prefix to use with named parameter. - /// If UseNamedParameters return false this property will not be used. - /// </summary> - /// <remarks> - /// Do NOT use this Property. It will be removed once the class ADOHack has been removed. Instead - /// the Driver should be used because that is what determines how the CommandText and Parameters - /// have to be built. - /// </remarks> - [Obsolete("This method will be removed once ADOHack is gone. The Driver should be used instead.")] - public virtual string NamedParametersPrefix - { - get { return String.Empty; } - } - /// <summary> --- 501,504 ---- Index: SybaseDialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/SybaseDialect.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SybaseDialect.cs 11 Jul 2004 21:04:13 -0000 1.9 --- SybaseDialect.cs 19 Aug 2004 17:45:25 -0000 1.10 *************** *** 63,75 **** } - [Obsolete("See the Dialect class for reason")] - public override bool UseNamedParameters { - get { return true; } - } - - [Obsolete("See the Dialect class for reason")] - public override string NamedParametersPrefix { - get { return "@"; } - } } } \ No newline at end of file --- 63,66 ---- Index: MsSql2000Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** MsSql2000Dialect.cs 16 Aug 2004 05:21:12 -0000 1.15 --- MsSql2000Dialect.cs 19 Aug 2004 17:45:25 -0000 1.16 *************** *** 113,129 **** { get { return "DEFAULT VALUES"; } ! } ! ! [Obsolete("See the Dialect class for reason")] ! public override bool UseNamedParameters ! { ! get { return true; } ! } ! ! [Obsolete("See the Dialect class for reason")] ! public override string NamedParametersPrefix ! { ! get { return "@"; } ! } public override int MaxAnsiStringSize --- 113,117 ---- { get { return "DEFAULT VALUES"; } ! } public override int MaxAnsiStringSize |
From: Michael D. <mik...@us...> - 2004-08-19 17:44:43
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SqlCommandTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19530/NHibernate.Test/SqlCommandTest Modified Files: SqlSelectBuilderFixture.cs Log Message: change a string to SqlString. Index: SqlSelectBuilderFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SqlCommandTest/SqlSelectBuilderFixture.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SqlSelectBuilderFixture.cs 19 Jul 2004 03:25:25 -0000 1.2 --- SqlSelectBuilderFixture.cs 19 Aug 2004 17:44:12 -0000 1.3 *************** *** 33,37 **** select.SetSelectClause("column1, column2"); select.SetFromClause("select_test", "select_test_alias"); ! select.SetOuterJoins(" LEFT OUTER JOIN before ON select_test_alias.column1 = before.column1", " LEFT OUTER JOIN after ON select_test_alias.column1 = after.column1"); select.SetOrderByClause("column1 DESC"); --- 33,37 ---- select.SetSelectClause("column1, column2"); select.SetFromClause("select_test", "select_test_alias"); ! select.SetOuterJoins( new SqlString(" LEFT OUTER JOIN before ON select_test_alias.column1 = before.column1"), new SqlString(" LEFT OUTER JOIN after ON select_test_alias.column1 = after.column1") ); select.SetOrderByClause("column1 DESC"); |
From: Michael D. <mik...@us...> - 2004-08-19 17:42:34
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19159/NHibernate/Collection Modified Files: CollectionPersister.cs Log Message: change a string to SqlString. Index: CollectionPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/CollectionPersister.cs,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** CollectionPersister.cs 16 Aug 2004 05:23:44 -0000 1.25 --- CollectionPersister.cs 19 Aug 2004 17:42:25 -0000 1.26 *************** *** 501,505 **** } ! public string MultiselectClauseFragment(string alias) { SelectFragment frag = new SelectFragment(dialect) --- 501,505 ---- } ! public SqlString MultiselectClauseFragment(string alias) { SelectFragment frag = new SelectFragment(dialect) *************** *** 510,514 **** if (hasIdentifier) frag.AddColumn(alias, identifierColumnName, identifierColumnAlias); ! return frag.ToSqlStringFragment(false).ToString(); } --- 510,514 ---- if (hasIdentifier) frag.AddColumn(alias, identifierColumnName, identifierColumnAlias); ! return frag.ToSqlStringFragment(false); } |
From: Michael D. <mik...@us...> - 2004-08-19 17:41:42
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18935/NHibernate/Cfg Modified Files: Binder.cs Log Message: removed an unneeded comment. Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Binder.cs 16 Aug 2004 05:07:45 -0000 1.27 --- Binder.cs 19 Aug 2004 17:41:18 -0000 1.28 *************** *** 1058,1061 **** --- 1058,1062 ---- private static void AddIndexForIndexedCollection(IndexedCollection model) { + //TODO: Find out why this is commented out // if ( model.IsOneToMany ) { // Index uniqueKey = model.Table.Index("x"); |
From: Michael D. <mik...@us...> - 2004-08-19 13:39:54
|
Update of /cvsroot/nhibernate/nhibernate/external-bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4857 Modified Files: FirebirdSql.Data.Firebird.dll Log Message: Updated to version 1.6.1 - thanks Carlos! Index: FirebirdSql.Data.Firebird.dll =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/external-bin/FirebirdSql.Data.Firebird.dll,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsTvkMoK and /tmp/cvs0sm1Jw differ |