internal void Finish(ObjectReaderBase <TDataReader> finishedReader) { if (_currentReader == finishedReader) { this.CheckNextResults(); } }
internal ObjectReader <TDataReader, TObject> GetNextResult <TObject>(Func <ObjectMaterializer <TDataReader>, TObject> fnMaterialize, NamedColumn[] namedColumns, object[] globals, int nLocals, bool disposeDataReader) { // skip forward to next results if (_buffer != null) { if (_indexNextBufferedReader >= _buffer.Count) { return(null); } } else { if (_currentReader != null) { // buffer current reader _currentReader.Buffer(); this.CheckNextResults(); } if (!_hasResults) { return(null); } } ObjectReader <TDataReader, TObject> objectReader = new ObjectReader <TDataReader, TObject>(this, namedColumns, globals, _userArgs, nLocals, disposeDataReader, fnMaterialize); _currentReader = objectReader; return(objectReader); }
internal ObjectReader <TDataReader, TObject> CreateReader <TObject>(Func <ObjectMaterializer <TDataReader>, TObject> fnMaterialize, NamedColumn[] namedColumns, object[] globals, int nLocals, bool disposeDataReader) { ObjectReader <TDataReader, TObject> objectReader = new ObjectReader <TDataReader, TObject>(this, namedColumns, globals, _userArgs, nLocals, disposeDataReader, fnMaterialize); _currentReader = objectReader; return(objectReader); }
private void CheckNextResults() { _hasResults = !_dataReader.IsClosed && _dataReader.NextResult(); _currentReader = null; if (!_hasResults) { this.Dispose(); } }