@@ -88,7 +88,7 @@ public sealed class NpgsqlDataReader : DbDataReader, IDbColumnSchemaGenerator
8888 /// Mostly useful for a sequential mode, when the row is already in the buffer.
8989 /// Should always be true for the non-sequential mode.
9090 /// </summary>
91- bool _canConsumeRowNonSequentially ;
91+ bool _isRowBuffered ;
9292
9393 /// <summary>
9494 /// The RowDescription message for the current resultset being processed
@@ -194,7 +194,7 @@ public override Task<bool> ReadAsync(CancellationToken cancellationToken)
194194 }
195195
196196 // We have a special case path for SingleRow.
197- if ( _behavior . HasFlag ( CommandBehavior . SingleRow ) || ! _canConsumeRowNonSequentially )
197+ if ( _behavior . HasFlag ( CommandBehavior . SingleRow ) || ! _isRowBuffered )
198198 return null ;
199199
200200 ConsumeRowNonSequential ( ) ;
@@ -810,7 +810,8 @@ internal void ProcessMessage(IBackendMessage msg)
810810 var msgRemainder = dataRow . Length - sizeof ( short ) ;
811811 _dataMsgEnd = readPosition + msgRemainder ;
812812 _columnsStartPos = readPosition ;
813- _canConsumeRowNonSequentially = msgRemainder <= Buffer . FilledBytes - readPosition ;
813+ _isRowBuffered = msgRemainder <= Buffer . FilledBytes - readPosition ;
814+ Debug . Assert ( _isRowBuffered || _isSequential ) ;
814815 _column = - 1 ;
815816
816817 if ( _columns . Count > 0 )
@@ -1537,8 +1538,8 @@ public Task<TextReader> GetTextReaderAsync(int ordinal, CancellationToken cancel
15371538 /// <returns></returns>
15381539 public override Task < T > GetFieldValueAsync < T > ( int ordinal , CancellationToken cancellationToken )
15391540 {
1540- // In non-sequential, we know that the column is already buffered - no I/O will take place
1541- if ( ! _isSequential )
1541+ // As the row is buffered we know the column is too - no I/O will take place
1542+ if ( _isRowBuffered )
15421543 return Task . FromResult ( GetFieldValueCore < T > ( ordinal ) ) ;
15431544
15441545 // The only statically mapped converter, it always exists.
@@ -1693,7 +1694,7 @@ public override bool IsDBNull(int ordinal)
16931694 /// <returns><b>true</b> if the specified column value is equivalent to <see cref="DBNull"/> otherwise <b>false</b>.</returns>
16941695 public override Task < bool > IsDBNullAsync ( int ordinal , CancellationToken cancellationToken )
16951696 {
1696- if ( ! _isSequential )
1697+ if ( _isRowBuffered )
16971698 return IsDBNull ( ordinal ) ? TrueTask : FalseTask ;
16981699
16991700 return Core ( ordinal , cancellationToken ) ;
@@ -2097,7 +2098,7 @@ Task ConsumeRow(bool async)
20972098 {
20982099 Debug. Assert( State is ReaderState. InResult or ReaderState. BeforeResult) ;
20992100
2100- if ( ! _canConsumeRowNonSequentially )
2101+ if ( ! _isRowBuffered )
21012102 return ConsumeRowSequential( async) ;
21022103
21032104 // We get here, if we're in a non-sequential mode (or the row is already in the buffer)
0 commit comments