@@ -134,13 +134,7 @@ private RecordBatch RecordBatch
134134
135135 public override void Close ( )
136136 {
137- if ( this . closeConnection )
138- {
139- this . adbcCommand ? . Connection ? . Close ( ) ;
140- }
141- this . adbcQueryResult . Stream ? . Dispose ( ) ;
142- this . adbcQueryResult . Stream = null ;
143- this . isClosed = true ;
137+ this . Dispose ( disposing : true ) ;
144138 }
145139
146140 public override bool GetBoolean ( int ordinal )
@@ -308,22 +302,23 @@ public override bool IsDBNull(int ordinal)
308302
309303 public override bool NextResult ( )
310304 {
311- this . recordBatch = ReadNextRecordBatchAsync ( ) . Result ;
312-
313- if ( this . recordBatch != null )
314- {
315- return true ;
316- }
317-
318305 return false ;
319306 }
320307
321308 protected override void Dispose ( bool disposing )
322309 {
323310 if ( disposing )
324311 {
312+ if ( this . closeConnection )
313+ {
314+ this . adbcCommand ? . Connection ? . Close ( ) ;
315+ }
316+
325317 this . recordBatch ? . Dispose ( ) ;
326318 this . recordBatch = null ;
319+ this . adbcQueryResult . Stream ? . Dispose ( ) ;
320+ this . adbcQueryResult . Stream = null ;
321+ this . isClosed = true ;
327322 }
328323 }
329324
@@ -339,6 +334,7 @@ public override bool Read()
339334 // If ReadNextRecordBatchAsync throws (e.g. server error mid-stream),
340335 // callers that retry Read() must not re-read stale rows from the
341336 // old batch — they must see the exception again immediately.
337+ this . recordBatch ? . Dispose ( ) ;
342338 this . recordBatch = null ;
343339 this . recordBatch = ReadNextRecordBatchAsync ( ) . Result ;
344340
0 commit comments