Skip to content

Commit 1df5f68

Browse files
Check readers before initiating a new MySql batch.
Fixes #1605.
1 parent 2965228 commit 1df5f68

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/NHibernate/AdoNet/MySqlClientBatchingBatcher.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ protected override int CountOfStatementsInCurrentBatch
3939

4040
public override void AddToBatch(IExpectation expectation)
4141
{
42+
// MySql batcher cannot be initiated if a data reader is still open: check them.
43+
if (CountOfStatementsInCurrentBatch == 0)
44+
CheckReaders();
45+
4246
totalExpectedRowsAffected += expectation.ExpectedRowCount;
4347
var batchUpdate = CurrentCommand;
4448
Prepare(batchUpdate);

0 commit comments

Comments
 (0)