Skip to content

Commit f86ba73

Browse files
Removes ExpandQueryParameters and RemoveUnusedCommandParameters methods from IBatcher
These methods do not seem relevant to the batch interface. In fact, ExpandQueryParameters is already on the IDriver interface which seems more appropriate.
1 parent 1814f91 commit f86ba73

File tree

3 files changed

+7
-34
lines changed

3 files changed

+7
-34
lines changed

src/NHibernate/AdoNet/AbstractBatcher.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,6 @@ public int ExecuteNonQuery(IDbCommand cmd)
222222
}
223223
}
224224

225-
public void RemoveUnusedCommandParameters(IDbCommand cmd, SqlString sqlString)
226-
{
227-
Driver.RemoveUnusedCommandParameters(cmd, sqlString);
228-
}
229-
230-
public void ExpandQueryParameters(IDbCommand cmd, SqlString sqlString)
231-
{
232-
Driver.ExpandQueryParameters(cmd, sqlString);
233-
}
234-
235225
public IDataReader ExecuteReader(IDbCommand cmd)
236226
{
237227
CheckReaders();

src/NHibernate/Engine/IBatcher.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -131,25 +131,6 @@ public interface IBatcher : IDisposable
131131
/// </remarks>
132132
int ExecuteNonQuery(IDbCommand cmd);
133133

134-
/// <summary>
135-
/// Remove 'extra' parameters from the IDbCommand
136-
/// </summary>
137-
/// <remarks>
138-
/// We sometimes create more parameters than necessary (see NH-2792 & also comments in SqlStringFormatter.ISqlStringVisitor.Parameter)
139-
/// </remarks>
140-
void RemoveUnusedCommandParameters(IDbCommand cmd, SqlString sqlString);
141-
142-
/// <summary>
143-
/// Expand the parameters of the cmd to have a single parameter for each parameter in the
144-
/// sql string
145-
/// </summary>
146-
/// <remarks>
147-
/// This is for databases that do not support named parameters. So, instead of a single parameter
148-
/// for 'select ... from MyTable t where t.Col1 = @p0 and t.Col2 = @p0' we can issue
149-
/// 'select ... from MyTable t where t.Col1 = ? and t.Col2 = ?'
150-
/// </remarks>
151-
void ExpandQueryParameters(IDbCommand cmd, SqlString sqlString);
152-
153134
/// <summary>
154135
/// Must be called when an exception occurs.
155136
/// </summary>

src/NHibernate/Loader/Loader.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
using NHibernate.AdoNet;
1212
using NHibernate.Cache;
13-
using NHibernate.Collection;
13+
using NHibernate.Collection;
14+
using NHibernate.Driver;
1415
using NHibernate.Engine;
1516
using NHibernate.Event;
1617
using NHibernate.Exceptions;
@@ -1146,10 +1147,11 @@ protected internal virtual IDbCommand PrepareQueryCommand(QueryParameters queryP
11461147
command.CommandTimeout = selection.Timeout;
11471148
}
11481149

1149-
sqlCommand.Bind(command, session);
1150-
1151-
session.Batcher.RemoveUnusedCommandParameters(command, sqlString);
1152-
session.Batcher.ExpandQueryParameters(command, sqlString);
1150+
sqlCommand.Bind(command, session);
1151+
1152+
IDriver driver = factory.ConnectionProvider.Driver;
1153+
driver.RemoveUnusedCommandParameters(command, sqlString);
1154+
driver.ExpandQueryParameters(command, sqlString);
11531155
}
11541156
catch (HibernateException)
11551157
{

0 commit comments

Comments
 (0)