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 && ( |