Skip to content

Commit 13d745a

Browse files
committed
Proper handling when no params are in batch.
1 parent 6054e3c commit 13d745a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbBatchCommand.cs

+8
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,10 @@ public int GetCurrentBatchSize()
558558
{
559559
throw new InvalidOperationException("Batch must be prepared.");
560560
}
561+
if (!HasParameters)
562+
{
563+
return 0;
564+
}
561565
return _batch.ComputeBatchSize(_batchParameters.Count, this);
562566
}
563567
public async Task<int> GetCurrentBatchSizeAsync(CancellationToken cancellationToken = default)
@@ -566,6 +570,10 @@ public async Task<int> GetCurrentBatchSizeAsync(CancellationToken cancellationTo
566570
{
567571
throw new InvalidOperationException("Batch must be prepared.");
568572
}
573+
if (!HasParameters)
574+
{
575+
return 0;
576+
}
569577
return await _batch.ComputeBatchSizeAsync(_batchParameters.Count, this, cancellationToken).ConfigureAwait(false);
570578
}
571579

0 commit comments

Comments
 (0)