From: <fab...@us...> - 2011-06-14 21:58:42
|
Revision: 5927 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5927&view=rev Author: fabiomaulo Date: 2011-06-14 21:58:36 +0000 (Tue, 14 Jun 2011) Log Message: ----------- Minor refactoring Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs trunk/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs trunk/nhibernate/src/NHibernate/Loader/Criteria/CriteriaLoader.cs trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs trunk/nhibernate/src/NHibernate/SqlCommand/SqlCommandImpl.cs Modified: trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2011-06-14 15:18:00 UTC (rev 5926) +++ trunk/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Loader/QueryLoader.cs 2011-06-14 21:58:36 UTC (rev 5927) @@ -486,7 +486,7 @@ command.CommandTimeout = selection.Timeout; } - sqlCommand.Bind(command, sqlQueryParametersList, 0, session); + sqlCommand.Bind(command, session); session.Batcher.ExpandQueryParameters(command, sqlString); } Modified: trunk/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2011-06-14 15:18:00 UTC (rev 5926) +++ trunk/nhibernate/src/NHibernate/Hql/Classic/QueryTranslator.cs 2011-06-14 21:58:36 UTC (rev 5927) @@ -354,7 +354,7 @@ command.CommandTimeout = selection.Timeout; } - sqlCommand.Bind(command, sqlQueryParametersList, 0, session); + sqlCommand.Bind(command, session); session.Batcher.ExpandQueryParameters(command, query); } Modified: trunk/nhibernate/src/NHibernate/Loader/Criteria/CriteriaLoader.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Loader/Criteria/CriteriaLoader.cs 2011-06-14 15:18:00 UTC (rev 5926) +++ trunk/nhibernate/src/NHibernate/Loader/Criteria/CriteriaLoader.cs 2011-06-14 21:58:36 UTC (rev 5927) @@ -231,7 +231,7 @@ command.CommandTimeout = selection.Timeout; } - sqlCommand.Bind(command, sqlQueryParametersList, 0, session); + sqlCommand.Bind(command, session); session.Batcher.ExpandQueryParameters(command, sqlString); } Modified: trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs 2011-06-14 15:18:00 UTC (rev 5926) +++ trunk/nhibernate/src/NHibernate/Loader/Custom/CustomLoader.cs 2011-06-14 21:58:36 UTC (rev 5927) @@ -371,7 +371,7 @@ // After the last modification to the SqlString we can collect all parameters types. parameterSpecs.ResetEffectiveExpectedType(queryParameters); - return new SqlCommand.SqlCommandImpl(sqlString, parameterSpecs, queryParameters, session.Factory); + return new SqlCommandImpl(sqlString, parameterSpecs, queryParameters, session.Factory); } public IType[] ResultTypes Modified: trunk/nhibernate/src/NHibernate/SqlCommand/SqlCommandImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/SqlCommand/SqlCommandImpl.cs 2011-06-14 15:18:00 UTC (rev 5926) +++ trunk/nhibernate/src/NHibernate/SqlCommand/SqlCommandImpl.cs 2011-06-14 21:58:36 UTC (rev 5927) @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Data; using System.Linq; @@ -21,6 +22,17 @@ /// <param name="singleSqlParametersOffset">The offset from where start the list of <see cref="IDataParameter"/>, in the given <paramref name="command"/>, for the this <see cref="SqlCommandImpl"/>. </param> /// <param name="session">The session against which the current execution is occuring.</param> void Bind(IDbCommand command, IList<Parameter> commandQueryParametersList, int singleSqlParametersOffset, ISessionImplementor session); + + /// <summary> + /// Bind the appropriate value into the given command. + /// </summary> + /// <param name="command">The command into which the value should be bound.</param> + /// <param name="session">The session against which the current execution is occuring.</param> + /// <remarks> + /// Use this method when the <paramref name="command"/> contains just 'this' instance of <see cref="ISqlCommand"/>. + /// Use the overload <see cref="Bind(IDbCommand, IList{Parameter}, int, ISessionImplementor)"/> when the <paramref name="command"/> contains more instances of <see cref="ISqlCommand"/>. + /// </remarks> + void Bind(IDbCommand command, ISessionImplementor session); } public class SqlCommandImpl : ISqlCommand @@ -79,5 +91,22 @@ parameterSpecification.Bind(command, commandQueryParametersList, singleSqlParametersOffset, SqlQueryParametersList, QueryParameters, session); } } + + /// <summary> + /// Bind the appropriate value into the given command. + /// </summary> + /// <param name="command">The command into which the value should be bound.</param> + /// <param name="session">The session against which the current execution is occuring.</param> + /// <remarks> + /// Use this method when the <paramref name="command"/> contains just 'this' instance of <see cref="ISqlCommand"/>. + /// Use the overload <see cref="Bind(IDbCommand, IList{Parameter}, int, ISessionImplementor)"/> when the <paramref name="command"/> contains more instances of <see cref="ISqlCommand"/>. + /// </remarks> + public void Bind(IDbCommand command, ISessionImplementor session) + { + foreach (IParameterSpecification parameterSpecification in Specifications) + { + parameterSpecification.Bind(command, SqlQueryParametersList, QueryParameters, session); + } + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |